Hi,

I tried crosscompiling kaffe 1.1.6 for the strongARM processor. When
using native threads, and testing with a 'Hello world' program, most of
the times kaffe would hang while trying to read
java/lang/IllegalThreadStateException.class from rt.jar. It only
succeeded in 2 out of 30 trials.

Trying with jthreads, kaffe runs. Then I run a test for the combined use
of ThreadGroup, Thread.sleep(),  Thread.interrupt(), and synchronized().
The test initiates 46 threads. The threads sleep for various predefined
time periods with Thread.sleep() and then continue their execution. They
also implement a simple handler for the InterruptedException. The main()
function, after starting the threads, enters an infinite loop, in which
when a counter reaches a predefined value, it interrupts some of the
running threads with Thread.interrupt(). The test keeps on running for
about 40 minutes to 4 hours and then it hangs.  The full version of the
test separates the threads into two teams and each team of threads
synchronizes on an object.


The same test also fails with the following JVMs:
kaffe-cvs 8/12/2004 ARM Linux   ( 5 minutes until hang)
kaffe-1.1.6 x86 Linux (< 1minute)
blackdown java 1.3.1 ARM Linux  (5 to 10 hours)
blackdown java 1.3.1 x86 Linux ( 4 minutes)

It works fine with blackdown java 1.4.2 x86 Linux

~iliverez
-------------------------

#java -fullversion

java full version "kaffe-1.4.2"

kaffe VM "1.1.6"

Copyright (c) 1996-2005 Kaffe.org project contributors (please see
  the source code for a full list of contributors).  All rights reserved.
Portions Copyright (c) 1996-2002 Transvirtual Technologies, Inc.

The Kaffe virtual machine is free software, licensed under the terms of
the GNU General Public License.  Kaffe.org is a an independent, free
software
community project, not directly affiliated with Transvirtual Technologies,
Inc.  Kaffe is a Trademark of Transvirtual Technologies, Inc.  Kaffe comes
with ABSOLUTELY NO WARRANTY.

Engine: Interpreter   Version: 1.1.6   Java Version: 1.4
Heap defaults: minimum size: 5 MB, maximum size: unlimited
Stack default size: 64 KB
Configuration/Compilation options:
)  Compile date     : Tue Dec 20 16:45:42 EET 2005
  Compile host     : draco
  Install prefix   : /usr/jre
  Thread system    : unix-jthreads
  Garbage Collector: kaffe-gc
  CC               : arm-linux-gcc
  CFLAGS           : -g -O2 -Wall -W -fsigned-char
-fno-omit-frame-pointer -DENABLE_BINRELOC
  LDFLAGS          :
  ChangeLog head   : 2005-09-20  Dalibor Topic  <[EMAIL PROTECTED]>


--------------------





/*   SleepTest.java: Test to investigate possible java VM bug in the combined use of Thread.sleep, 
 *                   Thread.interrupt, and sync
 *
 *  Copyright (c) 2005,  Ioannis Liverezas
 *                       [EMAIL PROTECTED]
 *
 *  All rights reserved.
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  
 */


import java.io.*;
import java.util.*;
import java.text.SimpleDateFormat;
import java.util.Date;


public class SleepTest 
{

	protected static boolean alive=true;
	protected static int[] sync1 = new int[1];
	protected static int[] sync2 = new int[1];
	protected static int[] sync3 = new int[1];
	private static SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy, HH:mm:ss.SSS");
	private static Date startDate;
	public static final ThreadGroup THREAD_GROUP =  new ThreadGroup("TESTGROUPS");

	public static Thread createThread(final long timeout, final String name, final int[] sync)
	{
		System.out.println("in createThread");
		final Thread nt = new Thread(THREAD_GROUP,
		   new Runnable() {
			   public void run() 
			   {
				   int i = 0;
				   int j = 0;
				   long c = 0;
				   while (alive) {
					   // synchronized (sync) {
					   System.out.println("Thread: " + name + " :sync :" + sync[0] + " Alive:" + sdf.format(new Date()));
					   System.out.println("Test started at " + sdf.format(startDate));
					   /* generate high cpu load */
					   for (i = 1; i < 100000; i++) {
						   j = i + 500;
						   i++;
						   c = j / i;
						   
					   }
					   //}
					   try {
						   Thread.sleep(timeout);
					   } catch (InterruptedException e) {
						   System.out.println("SLEEP INTERRUPTED");
						   System.out.println(name + ": i = " + i + c + j);
					   }
				   }
			   }
		   }, name ); 
		
		return nt;
	} 
	
	public static void main(String[] Args)
	{
		sync1[0]  = 1;
		sync2[0]  = 2;
		startDate = new Date();

		System.out.println("Creating Threads");
		Thread t1 = createThread(0, "Time05", sync1);
		Thread t2 = createThread(100, "Time100", sync1);
		Thread t3 = createThread(500, "Time500", sync2);
		Thread t4 = createThread(1000, "Time1000", sync1);
		Thread t5 = createThread(2000, "Time2000", sync1);
		Thread t6 = createThread(5000, "Time5000", sync2);
		Thread t7 = createThread(8000, "Time8000", sync1);
		Thread t8 = createThread(10000, "Time10000", sync2);
		Thread t9 = createThread(15000, "Time15000",sync1);
		Thread t10 = createThread(20000, "TimeD20000", sync1);
		Thread t11 = createThread(30000, "TimeD30000", sync1);
		Thread t12 = createThread(60000, "TimeD60000", sync2);
		Thread t13 = createThread(120000, "TimeD120000", sync1);
		Thread t14 = createThread(0, "TimeD5", sync1);
		Thread t15 = createThread(100, "TimD100", sync1);
		Thread t16 = createThread(500, "TimeD500", sync2);
		Thread t17 = createThread(1000, "TimeD1000", sync1);
		Thread t18 = createThread(2000, "TimeD2000", sync1);
		Thread t19 = createThread(5000, "TimeD5000", sync2);
		Thread t20 = createThread(8000, "TimeA8000", sync1);
		Thread t21 = createThread(10000, "TimeA10000", sync2);
		Thread t22 = createThread(15000, "TimeA15000",sync1);
		Thread t23 = createThread(20000, "TimeA20000", sync1);
		Thread t24 = createThread(30000, "TimeA30000", sync1);
		Thread t25 = createThread(60000, "TimeA60000", sync2);
		Thread t26 = createThread(120000, "TimeA120000", sync1);
	    Thread t27 = createThread(25000, "TimeA25000", sync1);
	 	Thread t28 = createThread(35000, "TimeA35000", sync1);
		Thread t29 = createThread(65000, "TimeA65000", sync2);
		Thread t30 = createThread(20000, "TimeB20000", sync1);
		Thread t31 = createThread(30000, "TimeB30000", sync1);
		Thread t32 = createThread(60000, "TimeB60000", sync2);
		Thread t33 = createThread(120000, "TimeB120000", sync1);
		Thread t34 = createThread(0, "TimeB0", sync1);
		Thread t35 = createThread(100, "TimB100", sync1);
		Thread t36 = createThread(500, "TimeB500", sync2);
		Thread t37 = createThread(1000, "TimeB1000", sync1);
		Thread t38 = createThread(2000, "TimeB2000", sync1);
		Thread t39 = createThread(5000, "TimeB5000", sync2);
		Thread t40 = createThread(8000, "TimeC8000", sync1);
		Thread t41 = createThread(10000, "TimeC10000", sync2);
		Thread t42 = createThread(15000, "TimeC15000",sync1);
		Thread t43 = createThread(20000, "TimeC20000", sync1);
		Thread t44 = createThread(30000, "TimeC30000", sync1);
		Thread t45 = createThread(60000, "TimeC60000", sync2);
		Thread t46 = createThread(120000, "TimeC120000", sync1);

		t1.start();  t2.start();  t3.start();  t4.start();  
		t5.start();  t6.start();  t7.start();  t8.start();
		t9.start();	 t10.start(); t11.start(); t12.start();
		t13.start(); t14.start(); t15.start(); t16.start(); 
		t17.start(); t18.start(); t19.start(); t20.start(); 
		t21.start(); t22.start(); t23.start(); t24.start();
		t25.start(); t26.start(); t27.start(); t28.start();
		t29.start(); t30.start(); t31.start(); t32.start();
		t33.start(); t34.start(); t35.start(); t36.start();
		t37.start(); t38.start(); t39.start(); t40.start();
		t41.start(); t42.start(); t43.start(); t44.start();
		t45.start(); t46.start();

		
		System.out.println("Threads started");
		
		int counter = 0;
		while (true) 
		{
			counter++;
			if (counter > 15000) {
	
					counter = 0;
					t1.interrupt();
					t2.interrupt();
					t3.interrupt();
					t4.interrupt();
					t5.interrupt();
					t16.interrupt();
					t17.interrupt();
					t20.interrupt();
					t21.interrupt();
					t22.interrupt();
					t23.interrupt();
					t30.interrupt();
					t31.interrupt();
					t32.interrupt();
					t35.interrupt();
					t40.interrupt();
					t41.interrupt();

			}
		}
		
	}

}


_______________________________________________
kaffe mailing list
[email protected]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe

Reply via email to