Kaffe deadlock using Thread.sleep()

Pete Brower pete at appx.com
Mon Aug 2 11:00:37 PDT 1999


I get a similar random lockup condition while doing a blocking socket read
using the 1.2v2 vm when I turn off the JIT compiler and turn on
the green threads to work around the garbage collection problems.

Pete Brower
pete at appx.com


----- Original Message ----- 
From: Sauro Puccini <qsapu at hotpop.com>
To: <kaffe at transvirtual.com>
Sent: Monday, August 02, 1999 1:32 PM
Subject: Kaffe deadlock using Thread.sleep()


> 
> I have detected a sort of deadlock problem using a Thread.sleep() during
> a timered Socket read; this problem happens randomly, but in my system
> it's easy to reproduce in less than 30 secs. I am currently using the
> Kaffe version 1.0b4 compiled with Cygwin32 under WinNT, and running the
> following sample :
> 
> import java.net.*;
> import java.io.*;
> 
> class Loop
> {
>     public static void main(String av[]) throws Exception {
>   final int LOOP_MAX = 10000000;
>   final int port = 45054;
>   ServerSocket server = null;
> 
>   try {
>    server = new ServerSocket(port);
>   } catch (IOException e) { System.out.println(e); }
> 
>         Thread t = new Thread() {
>             public void run() {
>     try {
>      Socket s = new Socket(InetAddress.getLocalHost(), port);
>      BufferedOutputStream out = new
> BufferedOutputStream(s.getOutputStream());
>      byte btx[]= new byte[10];
>      for (int i=0; i<LOOP_MAX; i++) {
>       try {
>        out.write(btx, 0, 10);
>       } catch (IOException e) { System.out.println(e); }
>       System.out.print("#");
>       try {
>        out.flush();
>       } catch (IOException e) { System.out.println(e); }
> //      System.out.print("$");
>       try {
>        Thread.sleep(30);
>       } catch (Exception e) {}
> //      System.out.print("%");
>      }
>      out.close();
>     } catch (Exception e) { System.out.println("Failure " + e); }
>       }
>   };
> 
>   t.start();
>         server.setSoTimeout(5000);
>         Socket rsocket = null;
>   try {
>    rsocket = server.accept();
>   } catch (InterruptedIOException e) { System.out.println(e); }
>   BufferedInputStream in = new
> BufferedInputStream(rsocket.getInputStream());
> 
>         rsocket.setSoTimeout(20);
>   byte brx[]= new byte[10];
> 
>   for (int i=0; i<LOOP_MAX; i++) {
>    int len=0;
>    try {
> //    System.out.print("^");
>     len = in.read(brx, 0, 10);
>    } catch (InterruptedIOException e) {}
>    if (len > 0)
>     System.out.print("@");
>    else
>     System.out.print(".");
>   }
>  }
> }
> 
> 
> 



More information about the kaffe mailing list