db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dyre Tjeldvoll <Dyre.Tjeldv...@oracle.com>
Subject Is shutting down databases and the engine thread safe?
Date Fri, 06 Dec 2013 10:39:57 GMT
Hi,

I'm wondering if it is safe

to call to 
DriverManager.getConncetion("jdbc:derby:somedb;shutdown=true") and
DriverManager.getConncetion("jdbc:derby:;shutdown=true")

from two threads simultaneously?

I seem to be in a situation where these two calls deadlock.

The first thread is at

"main" prio=10 tid=0x00007ff04c00a000 nid=0x639e waiting on condition 
[0x00007ff05102d000]
    java.lang.Thread.State: TIMED_WAITING (sleeping)
	at java.lang.Thread.sleep(Native Method)
	at 
org.apache.derby.impl.store.raw.data.RAFContainer.clean(RAFContainer.java:518)
	- locked <0x000000078665bbb0> (a 
org.apache.derby.impl.store.raw.data.RAFContainer4)
	at 
org.apache.derby.impl.services.cache.ConcurrentCache.cleanAndUnkeepEntry(ConcurrentCache.java:551)
	at 
org.apache.derby.impl.services.cache.ConcurrentCache.cleanCache(ConcurrentCache.java:509)
	at 
org.apache.derby.impl.services.cache.ConcurrentCache.cleanAll(ConcurrentCache.java:460)
	at 
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.checkpoint(BaseDataFileFactory.java:1239)
	at 
org.apache.derby.impl.store.raw.log.LogToFile.checkpointWithTran(LogToFile.java:1726)
	at 
org.apache.derby.impl.store.raw.log.LogToFile.checkpoint(LogToFile.java:1523)
	at org.apache.derby.impl.store.raw.RawStore.stop(RawStore.java:365)
	at 
org.apache.derby.impl.services.monitor.TopService.stop(TopService.java:443)
	at 
org.apache.derby.impl.services.monitor.TopService.shutdown(TopService.java:394)
	at 
org.apache.derby.impl.services.monitor.BaseMonitor.shutdown(BaseMonitor.java:229)
	at 
org.apache.derby.impl.services.monitor.FileMonitor.shutdown(FileMonitor.java:44)
	at 
org.apache.derby.impl.db.DatabaseContextImpl.cleanupOnError(DatabaseContextImpl.java:77)
	at 
org.apache.derby.iapi.services.context.ContextManager.cleanupOnError(ContextManager.java:347)
	at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.cleanupOnError(TransactionResourceImpl.java:461)
	at 
org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:658)
	at 
org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(InternalDriver.java:628)
	at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:282)
	at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:913)
	at 
org.apache.derby.jdbc.AutoloadedDriver.connect(AutoloadedDriver.java:147)
	at java.sql.DriverManager.getConnection(DriverManager.java:571)
	at java.sql.DriverManager.getConnection(DriverManager.java:233)

while the second is at

"Thread-2" prio=10 tid=0x00007ff04c386000 nid=0x63c0 waiting on 
condition [0x00007ff0442c6000]
    java.lang.Thread.State: RUNNABLE
	at 
org.apache.derby.iapi.services.context.ContextManager.<init>(ContextManager.java:121)
	at 
org.apache.derby.iapi.services.context.ContextService.newContextManager(ContextService.java:520)
	at 
org.apache.derby.impl.services.monitor.BaseMonitor.shutdown(BaseMonitor.java:191)
	at 
org.apache.derby.impl.services.monitor.FileMonitor.shutdown(FileMonitor.java:44)
	at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:273)
	at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:913)
	at 
org.apache.derby.jdbc.AutoloadedDriver.connect(AutoloadedDriver.java:147)
	at java.sql.DriverManager.getConnection(DriverManager.java:571)
	at java.sql.DriverManager.getConnection(DriverManager.java:233)

Mime
View raw message