On 22.06.10 10:03, Kristian Waagan wrote:
On 22.06.10 08:46, Luke Quinane wrote:
Hi Kristian,
I've played around with the code a bit during the day and the
attached patch seems to fix the problem where another thread is
stuck. I've never really look at the Derby code before so I'm not
confident that it is correct however it did seem to fix things for me.
Thanks Luke,
I think the person who has worked most on the lock system recently is
around. Hopefully he'll have a look at your patch.
To me the patch looks okay, but I don't have the cycles to verify it
at the moment. I will however apply it to trunk and run the regression
tests.
FYI, I didn't see any failures in the regression tests when applying the
patch to trunk (had to regenerate the patch for it to apply, see
attached file).
--
Kristian
My suspicions about write operations getting interrupted were
groundless in this case, so it seems you have hit a different issue.
Regards,
Index: java/engine/org/apache/derby/impl/services/locks/LockSet.java
===================================================================
--- java/engine/org/apache/derby/impl/services/locks/LockSet.java
(revision 956795)
+++ java/engine/org/apache/derby/impl/services/locks/LockSet.java
(working copy)
@@ -273,12 +273,18 @@
forever: for (;;) {
- byte wakeupReason = waitingLock.waitForGrant(actualTimeout);
-
+ byte wakeupReason = 0;
ActiveLock nextWaitingLock = null;
Object[] deadlockData = null;
try {
+ try {
+ wakeupReason = waitingLock.waitForGrant(actualTimeout);
+ } catch(StandardException e) {
+ nextWaitingLock = control.getNextWaiter(waitingLock,
true, this);
+ throw e;
+ }
+
boolean willQuitWait;
Enumeration timeoutLockTable = null;
long currentTime = 0;
Index: java/engine/org/apache/derby/impl/services/locks/ConcurrentLockSet.java
===================================================================
--- java/engine/org/apache/derby/impl/services/locks/ConcurrentLockSet.java
(revision 956795)
+++ java/engine/org/apache/derby/impl/services/locks/ConcurrentLockSet.java
(working copy)
@@ -460,12 +460,18 @@
forever: for (;;) {
- byte wakeupReason = waitingLock.waitForGrant(actualTimeout);
-
+ byte wakeupReason = 0;
ActiveLock nextWaitingLock = null;
Object[] deadlockData = null;
try {
+ try {
+ wakeupReason = waitingLock.waitForGrant(actualTimeout);
+ } catch(StandardException e) {
+ nextWaitingLock = control.getNextWaiter(waitingLock,
true, this);
+ throw e;
+ }
+
boolean willQuitWait;
Enumeration timeoutLockTable = null;
long currentTime = 0;