Derby
  1. Derby
  2. DERBY-5088

ShutdownException raised in istat thread during factory call

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.8.1.2
    • Fix Version/s: 10.8.1.2
    • Component/s: Services, Store
    • Labels:
      None
    • Issue & fix info:
      Patch Available

      Description

      Reported by Knut Anders in DERBY-5082:

      While running the repro script, I've also seen this exception printed to the console:

      Exception in thread "index-stat-thread" org.apache.derby.iapi.error.ShutdownException:
      at org.apache.derby.iapi.services.context.ContextService.getFactory(ContextService.java:210)
      at org.apache.derby.impl.services.daemon.IndexStatisticsDaemonImpl.run(IndexStatisticsDaemonImpl.java:700)
      at java.lang.Thread.run(Thread.java:619)

      ij didn't error out in that case, though.

      This happens when the database is shut down before the istat worker thread has been initialized.

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open In Progress In Progress
          2h 25m 1 Kristian Waagan 03/Mar/11 00:34
          In Progress In Progress Resolved Resolved
          3d 9h 9m 1 Kristian Waagan 06/Mar/11 09:43
          Resolved Resolved Closed Closed
          115d 23h 38m 1 Knut Anders Hatlen 30/Jun/11 10:21
          Gavin made changes -
          Workflow jira [ 12600517 ] Default workflow, editable Closed status [ 12801115 ]
          Knut Anders Hatlen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Rick Hillegas made changes -
          Affects Version/s 10.8.1.2 [ 12316362 ]
          Affects Version/s 10.8.1.1 [ 12316356 ]
          Fix Version/s 10.8.1.2 [ 12316362 ]
          Fix Version/s 10.8.1.1 [ 12316356 ]
          Rick Hillegas made changes -
          Affects Version/s 10.8.1.1 [ 12316356 ]
          Affects Version/s 10.8.1.0 [ 12315561 ]
          Fix Version/s 10.8.1.1 [ 12316356 ]
          Fix Version/s 10.8.1.0 [ 12315561 ]
          Kristian Waagan made changes -
          Link This issue is part of DERBY-4939 [ DERBY-4939 ]
          Kristian Waagan made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Fix Version/s 10.8.0.0 [ 12315561 ]
          Resolution Fixed [ 1 ]
          Hide
          Kristian Waagan added a comment -

          Resolving issue.

          Show
          Kristian Waagan added a comment - Resolving issue.
          Hide
          Lily Wei added a comment -

          That's okay. I understand. Thank Kristian for getting back to me so quickly.
          I meant when I was looking at the code, the code seems to do the right thing. My only concern is whether daemonLCC.getDatabase().isActive() at IndexStatisticDaemonImpl.isShuttingDown() always reflects reality. Will isActive() method only return true when database is up and running. However, I couldn't come out with a case that the value does not reflect reality.

          You are right about the database grow very large. After running ij with more memory, I can see the row grow to more than millions. It is still running after 20 minutes. If I do see stacktrace, I will post them. Thanks!

          Show
          Lily Wei added a comment - That's okay. I understand. Thank Kristian for getting back to me so quickly. I meant when I was looking at the code, the code seems to do the right thing. My only concern is whether daemonLCC.getDatabase().isActive() at IndexStatisticDaemonImpl.isShuttingDown() always reflects reality. Will isActive() method only return true when database is up and running. However, I couldn't come out with a case that the value does not reflect reality. You are right about the database grow very large. After running ij with more memory, I can see the row grow to more than millions. It is still running after 20 minutes. If I do see stacktrace, I will post them. Thanks!
          Hide
          Kristian Waagan added a comment -

          Sorry Lily, I didn't see your comment before after I committed the fix to trunk with revision 1076802.

          I don't quite understand what you mean with "From looking at the code, I don't see much." Can you please clarify?
          Note that if you reuse the database between runs it will quickly grow very large and may appear to hang while it is inserting data.

          The expected behavior for the fix is that you won't see the error / stacktrace reported by Knut when ij is exiting (which it will do when it has executed all the SQL commands in the script file). Since the bug is intermittent, it is not that easy to "prove" that it will never happen again.
          If you see it now, the stacktrace should be different.

          Show
          Kristian Waagan added a comment - Sorry Lily, I didn't see your comment before after I committed the fix to trunk with revision 1076802. I don't quite understand what you mean with "From looking at the code, I don't see much." Can you please clarify? Note that if you reuse the database between runs it will quickly grow very large and may appear to hang while it is inserting data. The expected behavior for the fix is that you won't see the error / stacktrace reported by Knut when ij is exiting (which it will do when it has executed all the SQL commands in the script file). Since the bug is intermittent, it is not that easy to "prove" that it will never happen again. If you see it now, the stacktrace should be different.
          Hide
          Lily Wei added a comment -

          Thanks, Kristian!! From looking at the code, I don't see much. When running the repro script, if I use the same db and get error and harmless telling me database exist and view already there, the script will hang. I understand this is a negative test. However, is this the expect behavior for the fix? Hope this help!

          Show
          Lily Wei added a comment - Thanks, Kristian!! From looking at the code, I don't see much. When running the repro script, if I use the same db and get error and harmless telling me database exist and view already there, the script will hang. I understand this is a negative test. However, is this the expect behavior for the fix? Hope this help!
          Hide
          Knut Anders Hatlen added a comment -

          Thanks, Kristian! I ran the DERBY-5082 repro script 70 times with the patch without seeing any problems, but I've only seen this problem once, so it's difficult to say for sure whether the problem is fixed. But in any case, +1 to commit.

          Show
          Knut Anders Hatlen added a comment - Thanks, Kristian! I ran the DERBY-5082 repro script 70 times with the patch without seeing any problems, but I've only seen this problem once, so it's difficult to say for sure whether the problem is fixed. But in any case, +1 to commit.
          Kristian Waagan made changes -
          Issue & fix info [Patch Available]
          Kristian Waagan made changes -
          Hide
          Kristian Waagan added a comment -

          Attaching patch 1a for review.
          Refactors the exception handling code somewhat, and moves the factory call inside the try-catch.

          Show
          Kristian Waagan added a comment - Attaching patch 1a for review. Refactors the exception handling code somewhat, and moves the factory call inside the try-catch.
          Kristian Waagan made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Kristian Waagan made changes -
          Field Original Value New Value
          Link This issue is depended upon by DERBY-5082 [ DERBY-5082 ]
          Knut Anders Hatlen created issue -

            People

            • Assignee:
              Kristian Waagan
              Reporter:
              Knut Anders Hatlen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved:

                Development