You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "weldon washburn (JIRA)" <ji...@apache.org> on 2007/06/18 18:30:26 UTC
[jira] Assigned: (HARMONY-3864) [drlvm][thread] VM sometimes hangs
after ThreadGroup.setMaxPriority()
[ https://issues.apache.org/jira/browse/HARMONY-3864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
weldon washburn reassigned HARMONY-3864:
----------------------------------------
Assignee: weldon washburn
> [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
>
> 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.