Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 95105 invoked from network); 21 Jun 2007 10:54:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Jun 2007 10:54:51 -0000 Received: (qmail 42046 invoked by uid 500); 21 Jun 2007 10:54:53 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 42007 invoked by uid 500); 21 Jun 2007 10:54:53 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 41984 invoked by uid 99); 21 Jun 2007 10:54:53 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Jun 2007 03:54:53 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Jun 2007 03:54:46 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5A9C671413F for ; Thu, 21 Jun 2007 03:54:26 -0700 (PDT) Message-ID: <18662850.1182423266368.JavaMail.jira@brutus> Date: Thu, 21 Jun 2007 03:54:26 -0700 (PDT) From: "Pavel Rebriy (JIRA)" To: commits@harmony.apache.org Subject: [jira] Updated: (HARMONY-3864) [drlvm][thread] VM sometimes hangs after ThreadGroup.setMaxPriority() In-Reply-To: <9375512.1179206236373.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-3864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Pavel Rebriy updated HARMONY-3864: ---------------------------------- Attachment: H3864.patch The patch to fix the issue. Usage of synchronized method in recursive execution and iteration leads to deadlock. The patch removes synchronized method and adds global thread group lock synchronization in recursive execution and thread group iterations. The patch was tested on 4 platforms - all 'build test' successfully passed. > [drlvm][thread] VM sometimes hangs after ThreadGroup.setMaxPriority() > --------------------------------------------------------------------- > > Key: HARMONY-3864 > URL: https://issues.apache.org/jira/browse/HARMONY-3864 > Project: Harmony > Issue Type: Bug > Components: DRLVM > Environment: Windows and Linux > Reporter: Vera Petrashkova > Assignee: weldon washburn > Priority: Minor > Attachments: global_lock.patch, H3864.patch, ThreadGroupTest.java > > > The following test demonstrates that sometimes VM hangs on some thread after invocation of > the method ThreadGroup.setMaxPriority(int) > ------------------ThreadGroupTest.java----------------- > import java.io.*; > public class ThreadGroupTest { > public static int nmbTG = 20; > public static int nmbTH = 20; > public static boolean isDaemon = false; > public static boolean setPrior = false; > public static void main(String[] args) { > if ((args.length >= 1) && "true".equals(args[0])) { > isDaemon = true; > } > if ((args.length >= 2) && "true".equals(args[1])) { > setPrior = true; > } > for (int t = 0; t < 100; t++) { > new ThreadGroupTest().test(); > System.err.println("Step: "+t+" finished"); > } > System.err.println("Test passed"); > } > public void test() { > ThreadGroup roottg = new ThreadGroup("root-tg"); > roottg.setDaemon(isDaemon); > Thread_t [] threads1 = new Thread_t[nmbTH]; > for (int i = 0; i < nmbTH; i ++) { > threads1[i] = new Thread_t(roottg,"roottg"); > } > ThreadGroup [] tg = new ThreadGroup[nmbTG]; > Thread_t [][] threads = new Thread_t[nmbTG][nmbTH]; > for (int i = 0; i < nmbTG; i ++) { > tg[i] = new ThreadGroup(i == 0 ? roottg : tg[i-1], Integer.toString(i)); > for (int j = 0; j < nmbTH; j++) { > threads[i][j] = new Thread_t(tg[i],Integer.toString(j)); > } > } > for (int i = 0; i < nmbTG; i ++) { > for (int j = 0; j < nmbTH; j++) { > threads[i][j].setDaemon(tg[i].isDaemon()); > threads[i][j].start(); > } > } > for (int i = 0; i < nmbTH; i ++) { > threads1[i].start(); > } > for (int i = 0; i < nmbTG; i++) { > for (int j = 0; j < nmbTH; j++) { > try { > threads[i][j].join(); > } catch (Throwable e) { > e.printStackTrace(); > } > } > } > for (int i = 0; i < nmbTH; i ++) { > try { > threads1[i].join(); > } catch (Throwable e) { > e.printStackTrace(); > } > } > } > } > class Thread_t extends Thread { > ThreadGroup tg; > String id; > public Thread_t (ThreadGroup tg, String n) { > super(tg, n); > this.tg = tg; > this.id = n; > } > public void run() { > int mp = tg.getMaxPriority(); > if (ThreadGroupTest.setPrior ) { > tg.setMaxPriority(2); > } > String[][] str = new String[10][100]; > for (int i = 0; i < str.length; ++i) { > > for (int j = 0; j < str[i].length; ++j) { > str[i][j] = "" + i + "" + j; > } > } > } > } > ------------------------------------------------------------------ > Run ThreadGroupTest several times > I can not reproduce the issue on Windows for non daemon threads. > But it is reproducible for daemon threads on Windows and for both kinds of thread on Linux. > java -cp . ThreadGroupTest true true > Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its l > icensors, as applicable. > java version "1.5.0" > pre-alpha : not complete or compatible > svn = r537729, (May 14 2007), Windows/ia32/msvc 1310, release build > http://incubator.apache.org/harmony > Step: 0 finished > Step: 1 finished > Step: 2 finished > Step: 3 finished > Step: 4 finished > Step: 5 finished > Step: 6 finished > Step: 7 finished > Step: 8 finished > Step: 9 finished > Step: 10 finished > Step: 11 finished > Step: 12 finished > java -cp . ThreadGroupTest false true > Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable. > java version "1.5.0" > pre-alpha : not complete or compatible > svn = r537729, (May 14 2007), Linux/ia32/gcc 3.3.3, release build > http://incubator.apache.org/harmony > Step: 0 finished > Step: 1 finished > Step: 2 finished > This bug causes the failure of the reliability test > api.kernel.threadgroup.EnumerateTest > from http://issues.apache.org/jira/browse/HARMONY-2918 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.