[kaffe] IllegalMonitorStateException under uClinux

Andrea Scian andrea.scian@wawnet.biz
Tue Sep 9 08:33:02 2003


Messaggio in formato MIME composto da pił parti.

------=_NextPart_000_014B_01C376F8.59A2BBF0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi all!
I'm still trying to make Kaffe running under uClinux. While it works =
preatty well using jthreads, now I need to use pthreads (because of =
native bocking methods).
After resolving a few problem with uClinux pthread support now I'm =
running a simple threading example (source code attached) that simple =
spawn a few threads, each one of them doing a System.out.println inside =
a loop.
The problem is that while most of the time the program works fine, =
sometimes (always if I increase the number of thread running) it give me =
the following message:=20

\> env KAFFE_NATIVE_LIBRARY_DIR=3D/kaffe/jre/lib/arm =
KAFFE_LIBDIR=3D/kaffe/lib LIBRARY_PATH=3D/kaffe/jre/lib/arm =
LD_LIBRARY_PATH=3D/kaffe/jre/lib/arm /kaffe/jre/bin/kaffe-bin -mx7M =
-ms7M -as1k  MultiThreadDemo

New thread: Thread[One,5,main]
New thread: Thread[Two,5,main]
One: 50
One: 49
Two: 50
New thread: Thread[Three,5,main]
One: 48
Two: 49
One: 47New thread: Thread[Four,5,main]

Two: 48
Three: 50
Three: 49java.lang.IllegalMonitorStateException
        at java.io.PrintStream.println(PrintStream.java:123)
New thread: Thread[Five,5,main]
Four: 50
Three: 48
Two: 47
Four: 49        at NewThread.run(MultiThreadDemo.java:17)
        at java.lang.Thread.run(Thread.java:334)

New thread: Thread[Six,5,main]Three: 47
Five: 50
Three: 46

Five: 49
Two: 46
New thread: Thread[Seven,5,main]
Five: 48
Main: 50
Five: 47
...
..
..
[a few line after]
..
.
.
Five: 37

Main: 42
Five: 36
Two: 38
Main: 41
Two: 37
java.lang.IllegalMonitorStateException
Seven: 41
Five: 35
Seven: 40
Two: 36Main: 40 at java.io.PrintStream.println(PrintStream.java:123)

Five: 34

Main: 39
        at NewThread.run(MultiThreadDemo.java:17)
Seven: 39
Main: 38        at java.lang.Thread.run(Thread.java:334)

Five: 33
Main: 37
Seven: 38
Seven: 37
java.lang.IllegalMonitorStateException
        at java.io.PrintStream.println(PrintStream.java:123)
        at NewThread.run(MultiThreadDemo.java:17)Main: 36

        at java.lang.Thread.run(Thread.java:334)
Seven: 36
Five: 32
Main: 35
Seven: 35
Main: 34
Five: 31
Seven: 34
Main: 33
Seven: 33
java.lang.IllegalMonitorStateException
Five: 30
Main: 32
Five: 29
Seven: 32       at java.io.PrintStream.println(PrintStream.java:123)

Five: 28
Seven: 31
        at NewThread.run(MultiThreadDemo.java:17)Main: 31

        at java.lang.Thread.run(Thread.java:334)
java.lang.IllegalMonitorStateException
        at java.io.PrintStream.println(PrintStream.java:123)
        at NewThread.run(MultiThreadDemo.java:17)Five: 27
Seven: 30
Five: 26

        at java.lang.Thread.run(Thread.java:334)
Seven: 29
Five: 25




Can anybody tell me if the problem is in my Kaffe build or in the =
uClinux pthread implementation? I mean did some of you enconter this =
error before (under linux or any other system)? Where could it come =
frome?

Thank you in advance!

------=_NextPart_000_014B_01C376F8.59A2BBF0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3315.2870" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi all!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I'm still trying to make Kaffe running =
under=20
uClinux. While it works preatty well using jthreads, now I need to use =
pthreads=20
(because of native bocking methods).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>After resolving a few problem with =
uClinux pthread=20
support now I'm running a simple threading example (source code =
attached) that=20
simple spawn a few threads, each one of them doing a System.out.println =
inside a=20
loop.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The problem is that while most of the =
time the=20
program works fine, sometimes (always if I increase the number of thread =

running) it give me the following message: </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>\&gt; env=20
KAFFE_NATIVE_LIBRARY_DIR=3D/kaffe/jre/lib/arm KAFFE_LIBDIR=3D/kaffe/lib=20
LIBRARY_PATH=3D/kaffe/jre/lib/arm LD_LIBRARY_PATH=3D/kaffe/jre/lib/arm=20
/kaffe/jre/bin/kaffe-bin -mx7M -ms7M -as1k&nbsp; =
MultiThreadDemo</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>New thread: Thread[One,5,main]<BR>New =
thread:=20
Thread[Two,5,main]<BR>One: 50<BR>One: 49<BR>Two: 50<BR>New thread:=20
Thread[Three,5,main]<BR>One: 48<BR>Two: 49<BR>One: 47New thread:=20
Thread[Four,5,main]</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Two: 48<BR>Three: 50<BR>Three:=20
49java.lang.IllegalMonitorStateException<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
at java.io.PrintStream.println(PrintStream.java:123)<BR>New thread:=20
Thread[Five,5,main]<BR>Four: 50<BR>Three: 48<BR>Two: 47<BR>Four:=20
49&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at=20
NewThread.run(MultiThreadDemo.java:17)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;=20
at java.lang.Thread.run(Thread.java:334)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>New thread: Thread[Six,5,main]Three: =
47<BR>Five:=20
50<BR>Three: 46</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><BR>Five: 49<BR>Two: 46<BR>New thread:=20
Thread[Seven,5,main]<BR>Five: 48<BR>Main: 50<BR>Five: 47</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>..</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>..</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>[a few line after]</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>..</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Five: 37</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Main: 42<BR>Five: 36<BR>Two: =
38<BR>Main: 41<BR>Two:=20
37<BR>java.lang.IllegalMonitorStateException<BR>Seven: 41<BR>Five: =
35<BR>Seven:=20
40<BR>Two: 36Main: 40 at=20
java.io.PrintStream.println(PrintStream.java:123)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Five: 34</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Main:=20
39<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at=20
NewThread.run(MultiThreadDemo.java:17)<BR>Seven: 39<BR>Main:=20
38&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at=20
java.lang.Thread.run(Thread.java:334)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Five: 33<BR>Main: 37<BR>Seven: =
38<BR>Seven:=20
37<BR>java.lang.IllegalMonitorStateException<BR>&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;=20
at=20
java.io.PrintStream.println(PrintStream.java:123)<BR>&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
at NewThread.run(MultiThreadDemo.java:17)Main: 36</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at=20
java.lang.Thread.run(Thread.java:334)<BR>Seven: 36<BR>Five: 32<BR>Main:=20
35<BR>Seven: 35<BR>Main: 34<BR>Five: 31<BR>Seven: 34<BR>Main: =
33<BR>Seven:=20
33<BR>java.lang.IllegalMonitorStateException<BR>Five: 30<BR>Main: =
32<BR>Five:=20
29<BR>Seven: 32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at=20
java.io.PrintStream.println(PrintStream.java:123)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Five: 28<BR>Seven:=20
31<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at=20
NewThread.run(MultiThreadDemo.java:17)Main: 31</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at=20
java.lang.Thread.run(Thread.java:334)<BR>java.lang.IllegalMonitorStateExc=
eption<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
at=20
java.io.PrintStream.println(PrintStream.java:123)<BR>&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
at NewThread.run(MultiThreadDemo.java:17)Five: 27<BR>Seven: 30<BR>Five:=20
26</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at=20
java.lang.Thread.run(Thread.java:334)<BR>Seven: 29<BR>Five: =
25</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Can anybody tell me if the problem is =
in my Kaffe=20
build or in the uClinux pthread implementation? I mean did some of you =
enconter=20
this error before (under linux or any other system)? Where could it come =

frome?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thank you in =
advance!</FONT></DIV></BODY></HTML>

------=_NextPart_000_014B_01C376F8.59A2BBF0--