Return-Path: Delivered-To: apmail-jakarta-jcs-dev-archive@www.apache.org Received: (qmail 28710 invoked from network); 15 Oct 2009 19:33:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Oct 2009 19:33:54 -0000 Received: (qmail 75373 invoked by uid 500); 15 Oct 2009 19:33:54 -0000 Delivered-To: apmail-jakarta-jcs-dev-archive@jakarta.apache.org Received: (qmail 75340 invoked by uid 500); 15 Oct 2009 19:33:54 -0000 Mailing-List: contact jcs-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "JCS Developers List" Delivered-To: mailing list jcs-dev@jakarta.apache.org Received: (qmail 75330 invoked by uid 99); 15 Oct 2009 19:33:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Oct 2009 19:33:54 +0000 X-ASF-Spam-Status: No, hits=-10.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Oct 2009 19:33:51 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 686AC234C48C for ; Thu, 15 Oct 2009 12:33:31 -0700 (PDT) Message-ID: <1943902282.1255635211426.JavaMail.jira@brutus> Date: Thu, 15 Oct 2009 12:33:31 -0700 (PDT) From: "Scott Archer (JIRA)" To: jcs-dev@jakarta.apache.org Subject: [jira] Updated: (JCS-69) Synchronization Problem in JCSWorker In-Reply-To: <2077477338.1255633771899.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/JCS-69?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Scott Archer updated JCS-69: ---------------------------- Description: When using the JCSWorker threads lock indefinitely. I believe the synchronized block in the finally block is synchronizing on and notifying the wrong object. Once a thread locks it never unlocks. Class: org.apache.jcs.utils.access.JCSWorker Method: private Object run( Serializable aKey, String aGroup, JCSWorkerHelper aHelper ) throws Exception Bad Code (in finally block): synchronized ( this ) { aHelper.setFinished( true ); // Wake everyone waiting on us notifyAll(); } Suggested Fix: synchronized ( aHelper ) { aHelper.setFinished( true ); // Wake everyone waiting on aHelper aHelper.notifyAll(); } was: When using the JCSWorker threads lock indefinitely. I believe the synchronized block in the finally block is synchronizing on the wrong object. Once a thread locks it never unlocks. Class: org.apache.jcs.utils.access.JCSWorker Method: private Object run( Serializable aKey, String aGroup, JCSWorkerHelper aHelper ) throws Exception Bad Code (in finally block): synchronized ( this ) { aHelper.setFinished( true ); // Wake everyone waiting on us notifyAll(); } Suggested Fix: synchronized ( aHelper ) { aHelper.setFinished( true ); // Wake everyone waiting on aHelper aHelper.notifyAll(); } > Synchronization Problem in JCSWorker > ------------------------------------ > > Key: JCS-69 > URL: https://issues.apache.org/jira/browse/JCS-69 > Project: JCS > Issue Type: Bug > Affects Versions: jcs-1.3, jcs-1.4-dev > Environment: Linux 2.6.28-15-generic #52-Ubuntu SMP Wed Sep 9 10:48:52 UTC 2009 x86_64 GNU/Linux > java version "1.6.0_16" > Java(TM) SE Runtime Environment (build 1.6.0_16-b01) > Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode) > Reporter: Scott Archer > Assignee: Aaron Smuts > > When using the JCSWorker threads lock indefinitely. > I believe the synchronized block in the finally block is synchronizing on and notifying the wrong object. > Once a thread locks it never unlocks. > Class: org.apache.jcs.utils.access.JCSWorker > Method: private Object run( Serializable aKey, String aGroup, JCSWorkerHelper aHelper ) throws Exception > Bad Code (in finally block): > synchronized ( this ) > { > aHelper.setFinished( true ); > // Wake everyone waiting on us > notifyAll(); > } > Suggested Fix: > synchronized ( aHelper ) > { > aHelper.setFinished( true ); > // Wake everyone waiting on aHelper > aHelper.notifyAll(); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: jcs-dev-help@jakarta.apache.org