Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DEF1A4DC0 for ; Tue, 31 May 2011 16:47:58 +0000 (UTC) Received: (qmail 94558 invoked by uid 500); 31 May 2011 16:47:58 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 94537 invoked by uid 500); 31 May 2011 16:47:58 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 94530 invoked by uid 99); 31 May 2011 16:47:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 May 2011 16:47:58 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 May 2011 16:47:57 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 674432388A2C; Tue, 31 May 2011 16:47:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1129797 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/util/InterruptStatus.java impl/jdbc/TransactionResourceImpl.java impl/services/locks/ConcurrentLockSet.java impl/services/locks/LockSet.java Date: Tue, 31 May 2011 16:47:37 -0000 To: derby-commits@db.apache.org From: dag@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110531164737.674432388A2C@eris.apache.org> Author: dag Date: Tue May 31 16:47:36 2011 New Revision: 1129797 URL: http://svn.apache.org/viewvc?rev=1129797&view=rev Log: DERBY-5243 assert failure in test testRAFReadWriteMultipleThreads: interrupted flag cleared Patch DERBY-5243-1: It moves the setting of the interrupted flag to just before CONN_INTERRUPT exception is thrown as an SQLException back to the user application, i.e. as late as possible. Previously, we set the interrupted flag when we first threw the internal StandardException. The new placement means that we are done with IO to derby.log which may be behind the problem we are seeing on older VMs. I ran the new version 100 times on Linux/JDK 5 without seeing the error, which previously appeared in ca 20% of the runs. Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/InterruptStatus.java db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/TransactionResourceImpl.java db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/ConcurrentLockSet.java db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/LockSet.java Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/InterruptStatus.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/InterruptStatus.java?rev=1129797&r1=1129796&r2=1129797&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/InterruptStatus.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/InterruptStatus.java Tue May 31 16:47:36 2011 @@ -273,8 +273,8 @@ public class InterruptStatus { if (e != null) { lcc.setInterruptedException(null); - // Set thread's interrupt status flag back on. - Thread.currentThread().interrupt(); + // Set thread's interrupt status flag back on: + // see TransactionResourceImpl#wrapInSQLException throw e; } Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/TransactionResourceImpl.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/TransactionResourceImpl.java?rev=1129797&r1=1129796&r2=1129797&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/TransactionResourceImpl.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/TransactionResourceImpl.java Tue May 31 16:47:36 2011 @@ -390,6 +390,10 @@ public final class TransactionResourceIm StandardException se = (StandardException) thrownException; + if (SQLState.CONN_INTERRUPT.equals(se.getSQLState())) { + Thread.currentThread().interrupt(); + } + if (se.getCause() == null) { // se is a single, unchained exception. Just convert it to an // SQLException. Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/ConcurrentLockSet.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/ConcurrentLockSet.java?rev=1129797&r1=1129796&r2=1129797&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/ConcurrentLockSet.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/ConcurrentLockSet.java Tue May 31 16:47:36 2011 @@ -601,7 +601,6 @@ forever: for (;;) { if (wakeupReason == Constants.WAITING_LOCK_INTERRUPTED) { - Thread.currentThread().interrupt(); throw StandardException. newException(SQLState.CONN_INTERRUPT); Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/LockSet.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/LockSet.java?rev=1129797&r1=1129796&r2=1129797&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/LockSet.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/LockSet.java Tue May 31 16:47:36 2011 @@ -413,8 +413,6 @@ forever: for (;;) { if (wakeupReason == Constants.WAITING_LOCK_INTERRUPTED) { - Thread.currentThread().interrupt(); - throw StandardException. newException(SQLState.CONN_INTERRUPT);