Subject | Re: [Firebird-Java] DataExpress problem JayBird 3 Beta |
---|---|
Author | Mark Rotteveel |
Post date | 2016-12-24T13:45:42Z |
On 23-12-2016 09:38, hugo.larson@... [Firebird-Java] wrote:
an incomplete synchronization during the creation/prepare of a prepared
statement.
Adding this synchronization made the exceptions go away. This seems to
indicate either parallel usage, or an unsynchronized read which shows a
stale value of the transaction. However on several runs of your test
application, it now shows an exhaustion of the connection pool instead
(some runs complete, some don't).
This seems to be caused by the fact that your code gets a connection
from the pool twice (maybe more?) for a single thread as myRefresh
(indirectly) calls itself (see stacktrace below). This also causes
dummyDb to be overwritten with an actual connection (which may or may
not be involved in the original problem).
"Thread-4" prio=6 tid=0x000000000ed24800 nid=0x11b0 waiting on condition
[0x0000000015afe000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x0000000780f185e0> (a
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
at
java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:374)
at dx.DbPool.getConn(DbPool.java:24)
at dx.MyQueryDataSet.setPoolconn(MyQueryDataSet.java:94)
at dx.MyQueryDataSet.execType(MyQueryDataSet.java:74)
at dx.MyQueryDataSet.myRefresh(MyQueryDataSet.java:57)
at dx.MyQueryDataSet.open(MyQueryDataSet.java:45)
at com.borland.dx.dataset.StorageDataSet.refresh(Unknown Source)
at com.borland.dx.sql.dataset.QueryDataSet.refresh(Unknown Source)
at dx.MyQueryDataSet.execType(MyQueryDataSet.java:78)
at dx.MyQueryDataSet.myRefresh(MyQueryDataSet.java:57)
at dx.MyQueryDataSet.refresh(MyQueryDataSet.java:38)
at dx.MainDbTest.execQds2(MainDbTest.java:93)
at dx.MainDbTest.access$200(MainDbTest.java:17)
at dx.MainDbTest$2.run(MainDbTest.java:53)
at java.lang.Thread.run(Thread.java:745)
Mark
--
Mark Rotteveel
> You are absolutely right that the connection object cannot be removed.With the code you sent, and inspection of the Jaybird code, I detected
> What I do is to replace it with a dummy Database object.
>
> I managed to hastily make a Eclipse project the provokes the exception.
>
> Will mail it to you soon.
an incomplete synchronization during the creation/prepare of a prepared
statement.
Adding this synchronization made the exceptions go away. This seems to
indicate either parallel usage, or an unsynchronized read which shows a
stale value of the transaction. However on several runs of your test
application, it now shows an exhaustion of the connection pool instead
(some runs complete, some don't).
This seems to be caused by the fact that your code gets a connection
from the pool twice (maybe more?) for a single thread as myRefresh
(indirectly) calls itself (see stacktrace below). This also causes
dummyDb to be overwritten with an actual connection (which may or may
not be involved in the original problem).
"Thread-4" prio=6 tid=0x000000000ed24800 nid=0x11b0 waiting on condition
[0x0000000015afe000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x0000000780f185e0> (a
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
at
java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:374)
at dx.DbPool.getConn(DbPool.java:24)
at dx.MyQueryDataSet.setPoolconn(MyQueryDataSet.java:94)
at dx.MyQueryDataSet.execType(MyQueryDataSet.java:74)
at dx.MyQueryDataSet.myRefresh(MyQueryDataSet.java:57)
at dx.MyQueryDataSet.open(MyQueryDataSet.java:45)
at com.borland.dx.dataset.StorageDataSet.refresh(Unknown Source)
at com.borland.dx.sql.dataset.QueryDataSet.refresh(Unknown Source)
at dx.MyQueryDataSet.execType(MyQueryDataSet.java:78)
at dx.MyQueryDataSet.myRefresh(MyQueryDataSet.java:57)
at dx.MyQueryDataSet.refresh(MyQueryDataSet.java:38)
at dx.MainDbTest.execQds2(MainDbTest.java:93)
at dx.MainDbTest.access$200(MainDbTest.java:17)
at dx.MainDbTest$2.run(MainDbTest.java:53)
at java.lang.Thread.run(Thread.java:745)
Mark
--
Mark Rotteveel