glassfish
  1. glassfish
  2. GLASSFISH-20313

NPE in buildLogFileIndex after rotated log file

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0_b84_RC1
    • Fix Version/s: 4.0_b85
    • Component/s: logging
    • Labels:
      None

      Description

      This can be reproduced consistently. Steps to reproduce:

      1. go to Server (Admin Server) and click "Rotate Log File" button. Log file is rotated, works fine.
      2. click the "View Log File" button, the logViewer will show up, but because of the NPE, there is the message "An error has occured", and there is no log shown.
      3. click the search button again, and it now works fine.

      Here is the stack trace;

      [#|2013-04-15T11:51:17.577-0700|INFO|glassfish 4.0|javax.enterprise.admin.rest|_ThreadID=34;_ThreadName=admin-listener(2);_TimeMillis=1366051877577;_LevelValue=800;_MessageID=NCLS-REST-00003;|
      An error occurred while processing the request. Please see the server logs for details.
      java.lang.RuntimeException: java.lang.NullPointerException
      at com.sun.enterprise.server.logging.logviewer.backend.LogFile.buildLogFileIndex(LogFile.java:209)
      at com.sun.enterprise.server.logging.logviewer.backend.LogFile.getLastIndexNumber(LogFile.java:284)
      at com.sun.enterprise.server.logging.logviewer.backend.LogFilter.getLogRecordsUsingQuery(LogFilter.java:202)
      at com.sun.enterprise.server.logging.logviewer.backend.LogFilter.getLogRecordsUsingQuery(LogFilter.java:349)
      at org.glassfish.admin.rest.resources.custom.StructuredLogViewerResource.getWithType(StructuredLogViewerResource.java:176)
      at org.glassfish.admin.rest.resources.custom.StructuredLogViewerResource.getJson(StructuredLogViewerResource.java:100)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:125)
      at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:195)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:91)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:346)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:341)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101)
      at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:217)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:231)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:227)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:275)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:257)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:227)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
      at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:191)
      at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:819)
      at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:325)
      at org.glassfish.admin.rest.adapter.RestAdapter$2.service(RestAdapter.java:318)
      at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:181)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
      at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
      at java.lang.Thread.run(Thread.java:722)
      Caused by: java.lang.NullPointerException
      at java.util.regex.Matcher.getTextLength(Matcher.java:1234)
      at java.util.regex.Matcher.reset(Matcher.java:308)
      at java.util.regex.Matcher.<init>(Matcher.java:228)
      at java.util.regex.Pattern.matcher(Pattern.java:1088)
      at com.sun.enterprise.server.logging.parser.LogParserFactory.detectLogFormat(LogParserFactory.java:115)
      at com.sun.enterprise.server.logging.parser.LogParserFactory.createLogParser(LogParserFactory.java:90)
      at com.sun.enterprise.server.logging.logviewer.backend.LogFile.buildLogFileIndex(LogFile.java:185)
      ... 46 more

      #]

        Activity

        Hide
        rajendra_inamdar added a comment -

        Looks like it is trying to index the empty file after it is rotated.

        Show
        rajendra_inamdar added a comment - Looks like it is trying to index the empty file after it is rotated.
        Hide
        sandeep.shrivastava added a comment -
        • What is the impact on the customer of the bug?

        Customer will run into this issue if he/she opens the log viewer for a log file immediately after it has been rotated and the current log file is still empty.

        How likely is it that a customer will see the bug and how serious is the bug?

        There is a medium probability that the customer will run into this issue, if they are actively viewing the log files and the rotation happens.

        Is it a regression? Does it meet other bug fix criteria (security, performance, etc.)?

        The exception did not happen in GF 3.1.2.2, it is happening in new code added to support both ODL and Uniform log format. There was no exception in the prior release, the log viewer did not show any records for the empty log file.

        What CTS failures are caused by this bug?

        There are no CTS failures due to this issue.

        • What is the cost/risk of fixing the bug?

        How risky is the fix? How much work is the fix? Is the fix complicated?

        The fix is straight forward to handle the empty log file. Low risk.

        • Is there an impact on documentation or message strings?

        No

        • Which tests should QA (re)run to verify the fix did not destabilize GlassFish?

        This only affects the UI. Anissa has verified the fix offline.

        • Which is the targeted build of 4.0 for this fix?

        4.0_b85

        • If this an integration of a new version of a component from another project,
          what are the changes that are being brought in? This might be list of
          Jira issues from that project or a list of revision messages.

        N/A

        Show
        sandeep.shrivastava added a comment - What is the impact on the customer of the bug? Customer will run into this issue if he/she opens the log viewer for a log file immediately after it has been rotated and the current log file is still empty. How likely is it that a customer will see the bug and how serious is the bug? There is a medium probability that the customer will run into this issue, if they are actively viewing the log files and the rotation happens. Is it a regression? Does it meet other bug fix criteria (security, performance, etc.)? The exception did not happen in GF 3.1.2.2, it is happening in new code added to support both ODL and Uniform log format. There was no exception in the prior release, the log viewer did not show any records for the empty log file. What CTS failures are caused by this bug? There are no CTS failures due to this issue. What is the cost/risk of fixing the bug? How risky is the fix? How much work is the fix? Is the fix complicated? The fix is straight forward to handle the empty log file. Low risk. Is there an impact on documentation or message strings? No Which tests should QA (re)run to verify the fix did not destabilize GlassFish? This only affects the UI. Anissa has verified the fix offline. Which is the targeted build of 4.0 for this fix? 4.0_b85 If this an integration of a new version of a component from another project, what are the changes that are being brought in? This might be list of Jira issues from that project or a list of revision messages. N/A
        Hide
        Tom Mueller added a comment -

        Approved for 4.0.

        Show
        Tom Mueller added a comment - Approved for 4.0.
        Hide
        sandeep.shrivastava added a comment -

        This is fixed with revision 61489.

        Show
        sandeep.shrivastava added a comment - This is fixed with revision 61489.

          People

          • Assignee:
            sandeep.shrivastava
            Reporter:
            Anissa Lam
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: