Uploaded image for project: 'JBoss Log Manager'
  1. JBoss Log Manager
  2. LOGMGR-276

NPE is triggered if an previous error occur in rollOver

XMLWordPrintable

    • Hide

      A possible fix could be a flag on the rollOver so then we know if the file was set to null OR verify if it's not null

          private void rollOver() {
              try {
                  final File file = getFile();
                  // first, close the original file (some OSes won't let you move/rename a file that is open)
                  
                  if (file.exists() || file.length() != 0) //Suggestion.
                      setFile(null);
                  // next, rotate it
                  suffixRotator.rotate(getErrorManager(), file.toPath(), nextSuffix);
                  // start new file
                  setFile(file);
              } catch (IOException e) {
                  reportError("Unable to rotate log file", e, ErrorManager.OPEN_FAILURE);
              }
      }
      
      Show
      A possible fix could be a flag on the rollOver so then we know if the file was set to null OR verify if it's not null private void rollOver() { try { final File file = getFile(); // first, close the original file (some OSes won't let you move/rename a file that is open) if (file.exists() || file.length() != 0) //Suggestion. setFile( null ); // next, rotate it suffixRotator.rotate(getErrorManager(), file.toPath(), nextSuffix); // start new file setFile(file); } catch (IOException e) { reportError( "Unable to rotate log file" , e, ErrorManager.OPEN_FAILURE); } }

      INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: JBoss EAP 7.2.8.GA (WildFly Core 6.0.27.Final-redhat-00001) started in 38333ms - Started 607 of 793 services (338 services are lazy, passive or on-demand)
      [0mLogManager error of type WRITE_FAILURE: Error writing log message
      java.lang.NullPointerException
          at org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.rollOver(PeriodicRotatingFileHandler.java:197)
          at org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.preWrite(PeriodicRotatingFileHandler.java:115)
          at org.jboss.logmanager.handlers.WriterHandler.doPublish(WriterHandler.java:60)
          at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:77)
          at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:333)
          at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
          at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
          at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
          at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
          at org.jboss.logmanager.Logger.logRaw(Logger.java:850)
          at org.jboss.logmanager.Logger.log(Logger.java:802)
          at org.jboss.logging.JBossLogManagerLogger.doLogf(JBossLogManagerLogger.java:53)
          at org.jboss.logging.Logger.logf(Logger.java:2431)
          at org.wildfly.security.manager._private.SecurityMessages_$logger.accessCheckFailed(SecurityMessages_$logger.java:44)
          at org.wildfly.security.manager.WildFlySecurityManager.findAccessDenial(WildFlySecurityManager.java:238)
          at org.wildfly.security.manager.WildFlySecurityManager.checkPermission(WildFlySecurityManager.java:305)
          at org.wildfly.security.manager.WildFlySecurityManager.checkPermission(WildFlySecurityManager.java:204)
          at org.jboss.logmanager.ExtHandler.checkAccess(ExtHandler.java:314)
          at org.jboss.logmanager.handlers.WriterHandler.setWriter(WriterHandler.java:92)
          at org.jboss.logmanager.handlers.OutputStreamHandler.setWriter(OutputStreamHandler.java:102)
          at org.jboss.logmanager.handlers.OutputStreamHandler.setOutputStream(OutputStreamHandler.java:119)
          at org.jboss.logmanager.handlers.FileHandler.setFile(FileHandler.java:143)
          at org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.setFile(PeriodicRotatingFileHandler.java:104)
          at org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.rollOver(PeriodicRotatingFileHandler.java:195)
          at org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.preWrite(PeriodicRotatingFileHandler.java:115)
          at org.jboss.logmanager.handlers.WriterHandler.doPublish(WriterHandler.java:60)
          at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:77)
          at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:333)
          at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
          at org.jboss.logmanager.Logger.logRaw(Logger.java:850)
          at org.jboss.logmanager.Logger.log(Logger.java:596)
          at org.jboss.stdio.AbstractLoggingWriter.write(AbstractLoggingWriter.java:71)
          at org.jboss.stdio.WriterOutputStream.finish(WriterOutputStream.java:143)
          at org.jboss.stdio.WriterOutputStream.flush(WriterOutputStream.java:164)
          at java.io.PrintStream.write(PrintStream.java:482)
          at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
          at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
          at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:104)
          at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:185)
          at java.io.PrintStream.newLine(PrintStream.java:546)
          at java.io.PrintStream.println(PrintStream.java:807)
          at org.jboss.stdio.StdioContext$DelegatingPrintStream.println(StdioContext.java:474)
          at org.example.ExampleProcessor.invokeFileProcessor(ExampleProcessor.java:32)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
          at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
          at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:111)
          at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:806)
          at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:729)
          at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
          at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
          at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
          at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
          at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:686)
          at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:791)
          at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
          at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
          at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
          at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
          at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
          at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
          at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
          at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
          at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
          at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
          at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
          at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
          at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
          at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
          at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
          at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
          at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
          at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
          at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
          at org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
          at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
          at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:269)
          at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:78)
          at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:133)
          at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:130)
          at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
          at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
          at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
          at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504)
          at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504)
          at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504)
          at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504)
          at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504)
          at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:249)
          at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:78)
          at io.undertow.servlet.handlers.ServletInitialHandler$1$1.run(ServletInitialHandler.java:105)
          at java.security.AccessController.doPrivileged(Native Method)
          at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:102)
          at io.undertow.server.Connectors.executeRootHandler(Connectors.java:376)
          at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
          at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
          at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
          at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
          at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
          at java.lang.Thread.run(Thread.java:748)
      

              jperkins-rhn James Perkins
              jperkins-rhn James Perkins
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: