bug in finalizer?

Godmar Back gback at cs.utah.edu
Tue Oct 13 09:36:12 PDT 1998


> 
> Hi Godmar,
> Hi Archie,
> 
> > I don't know what's causing it though... could you run it with
> > -vmdebug DETECTDEADLOCK?  Also, does it occur under gdb and if so,
> > can you get backtraces of the threads involved.  I'll try to 
> > reproduce it.
> 
> I found the bug:
> 
> The finalizer thread write a lot on STDOUT and,
> in jthreadedWrite(), write() return -1 with errno == EAGAIN
> (on MP-RAS, EWOULDBLOCK == EAGAIN). The current thread block
> until IO could continue: blockOnFile(fd, TH_WRITE).  It will
> be wakeup later by handleIO().
> But, handeIO() is only called:
> 1. on signal SIGIO.
>   fail: SIGIO is not send for STDOUT
> 2. in reschedule() iif there is no thread to reschedule.
>   fail: the main thread and GC ?
> 3. on 20th signal SIGVTALRM.
>   fail: The are no thread in the alarmList, setitimer() is never called
> 

 No, SIGVTALRM doesn't depend on the alarmList at all.

I think another hack I added is biting us here: namely that SIGVTALRM
is only activated once a second Java thread is created.
(See if (talive > 3)).  I'll fix that.  That whole "poll on every 20th
SIGVTALRM for I/O" sucks anyway.  If anybody has another work-around,
I'd be happy to hear it.  No wonder Sun didn't even try in their threads
implementation (Sun blocks the whole process on TTY reads and writes).

	- Godmar



More information about the kaffe mailing list