[Advanced-java] Wierd Behavior at time of creating a thread -
Joerg Thoennes
Joerg.Thoennes at macd.com
Tue Mar 25 10:29:43 2003
Kashikar, Makarand wrote:
> Hi all,
> I need to know if anyone of you has experienced this kind of behavior
>
> Solaris Info :
> Release: 5.7
> Kernel architecture: sun4u
> Application architecture: sparc
> Hardware provider: Sun_Microsystems
> Domain:
> Kernel version: SunOS 5.7 Generic 106541-19
Solaris 7 is quite old now. Do you have the chance to switch at least to Solaris 8.
> JDK info :
> java version "1.3.1"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
> Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
>
> When my java server starts - in the main thread i do this -
>
> System.out.println("Creating the my Thread");
> lt = new MyThread (); // and the MyThread extends from java.lang.Thread
>
> // MyThread in simplest form looks like this -
> public class MyThread extends Thread
> {
> public MyThread()
> {
> super("My thread");
> System.out.println("Super returned");
> }
> }
>
> Like once in 20 times (this is also random)
> sometimes the program just hangs at the statement "lt = new MyThread ();"
> so what I see in log file is "Creating the my Thread" and then I never see
> "Super returned".
>
> Basically looks like the thread constructor doesnt return -
>
> Has anyone experienced this kind of situation -
No, we did not. But you should give the below mentioned workaround a try anyway.
> There is a bug for this which is close to this situation -
> http://developer.java.sun.com/developer/bugParade/bugs/4545731.html
The workarounds provided in the bug report are quite usable. The T1 thread lib
in Solaris implements a N:M mapping of user level thread to kernel level LWPs
(Light Weight Processes). This add complexitity and therefore there habe always
been issues with the T1 libthread. Beginning with Solaris 8 an alternative
implementation in /usr/lib/lwp/libthread.so is provided which simply maps
every user thread to its own kernel LWP. (I am not sure for Solaris 7,
therefore the upgrade suggestion above.) This can be done since the newer kernels
are able to handle lots of LWPs. Since this library is less complex and fewer
issues are expected, it is the libthread default beginning with Solaris 9.
>
> I am going to try this -XX:+UseBoundThreads option -
> but any other help would be greatly appreciated -
This options request from the T1 libthread to map every thread created to a new LWP.
This leads to a 1:1 mapping which is basically the same as gained from the T2 lib.
Nevertheless, the T1 lib still contains the more complex code for N:M mappings, so
I regard this alternative as the second best choice.
>
> Makarand Kashikar
> _______________________________________________
> Advanced-java mailing list
> Advanced-java@lists.xcf.berkeley.edu
> http://lists.xcf.berkeley.edu/mailman/listinfo/advanced-java
>
--
Joerg Thoennes
http://macd.com
Tel.: +49 (0)241 44597-24 Macdonald Associates GmbH
Fax : +49 (0)241 44597-10 Lothringer Str. 52, D-52070 Aachen