db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-5190) store/rollForwardRecovery.sql stuck in RAFContainer4.writePage() during shutdown
Date Thu, 14 Apr 2011 16:57:05 GMT

    [ https://issues.apache.org/jira/browse/DERBY-5190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13019908#comment-13019908

Dag H. Wanvik commented on DERBY-5190:

The only way writePage can hang in a wait is in this piece of code:

// Gain entry
while (restoreChannelInProgress) {
  try {
  } catch (InterruptedException e) {

and since there is no other thread in the NIO code (verified with jstack), another thread
must have returned without resetting restoreChannelInProgress and giving notification.

On line 836 in recoverContainerAfterInterrupt we see this code:

if (retries-- == 0) {
    throw StandardException.newException(

which is not inside the try catch block which releases restoreChannelInProgress with notification
to waiters. So, if for some reason, this loop maxes out, while this thread then gives an error
(this is during shutdown so the error will be ignored), any other thread waiting for restoreChannelInProgress
to become false will hang as seen. As far as I can see this construction on line 836 is the
only way we can exit from recoverContainerAfterInterrupt without resetting restoreChannelInProgress.

> store/rollForwardRecovery.sql stuck in RAFContainer4.writePage() during shutdown
> --------------------------------------------------------------------------------
>                 Key: DERBY-5190
>                 URL: https://issues.apache.org/jira/browse/DERBY-5190
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions:
>         Environment: Oracle Enterprise Linux 6.0
> Linux 2.6.32-100.28.9.el6.x86_64 #1 SMP Wed Mar 16 19:24:16 EDT 2011 x86_64 x86_64 x86_64
> java version "1.6.0_17"
> OpenJDK Runtime Environment (IcedTea6 1.7.10) (rhel-1.39.b17.el6_0-x86_64)
> OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)
>            Reporter: Knut Anders Hatlen
> Saw store/rollForwardRecovery.sql hanging during shutdown with this trace:
> "main" prio=10 tid=0x00007f9f0c009000 nid=0x571 in Object.wait() [0x00007f9f123eb000]
>    java.lang.Thread.State: WAITING (on object monitor)
> 	at java.lang.Object.wait(Native Method)
> 	- waiting on <0x00007f9ee3eccf58> (a java.lang.Object)
> 	at java.lang.Object.wait(Object.java:502)
> 	at org.apache.derby.impl.store.raw.data.RAFContainer4.writePage(Unknown Source)
> 	- locked <0x00007f9ee3eccf58> (a java.lang.Object)
> 	at org.apache.derby.impl.store.raw.data.CachedPage.writePage(Unknown Source)
> 	at org.apache.derby.impl.store.raw.data.CachedPage.clean(Unknown Source)
> 	at org.apache.derby.impl.services.cache.ConcurrentCache.cleanAndUnkeepEntry(Unknown
> 	at org.apache.derby.impl.services.cache.ConcurrentCache.cleanCache(Unknown Source)
> 	at org.apache.derby.impl.services.cache.ConcurrentCache.cleanAll(Unknown Source)
> 	at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.checkpoint(Unknown Source)
> 	at org.apache.derby.impl.store.raw.log.LogToFile.checkpointWithTran(Unknown Source)
> 	at org.apache.derby.impl.store.raw.log.LogToFile.checkpoint(Unknown Source)
> 	at org.apache.derby.impl.store.raw.RawStore.stop(Unknown Source)
> 	at org.apache.derby.impl.services.monitor.TopService.stop(Unknown Source)
> 	at org.apache.derby.impl.services.monitor.TopService.shutdown(Unknown Source)
> 	at org.apache.derby.impl.services.monitor.BaseMonitor.shutdown(Unknown Source)
> 	at org.apache.derby.impl.services.monitor.BaseMonitor.shutdown(Unknown Source)
> 	at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
> 	at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
> 	at java.sql.DriverManager.getConnection(DriverManager.java:620)
> 	at java.sql.DriverManager.getConnection(DriverManager.java:222)
> 	at org.apache.derby.impl.tools.ij.utilMain.cleanupGo(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.Main.main(Unknown Source)
> 	at org.apache.derby.tools.ij.main(Unknown Source)

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message