cvs commit: src/lib/libkse/thread thr_kern.c

Arno J. Klaassen arno at heho.snv.jussieu.fr
Mon Dec 3 06:00:21 PST 2007


Daniel Eischen <deischen at freebsd.org> writes:

> On Mon, 3 Dec 2007, David Xu wrote:
> 
> > Daniel Eischen wrote:
> >> Yes, this would seem to be a kernel problem, as _get_curthread()
> >> seems to be returning garbage.  This is a libkse MD function,
> >> that relies on %gs (for i386/amd64) to point to something
> >> that was initialized in the parent.
> >> Julian, David, got any ideas?
> >>
> >
> > I don't know, I am still reading some kernel code.
> 
> I think it is possible that the fork()ing thread blocks
> before the vm space is copied to the child and an upcall is
> made.  The curthread is changed before the vm space is copied
> (or set to NULL) in the parent KSE/thread.  Then the child
> thread/process unblocks and completes, getting a copy of the
> vm space with curthread set to an invalid value (NULL or
> another now non-existent thread).
> 
> I'm not sure what is suppose to happen with fork() in this
> case.  Perhaps I should just commit the patch to work around
> the problem, or put the KSE in a critical region across a
> fork() so that an upcall doesn't happen.
> 
> I'm not sure why libthr has similar problems, although harder
> to reproduce.  This would seem a problem limited to libkse.

I do not pretend it is the same problem, it might just be related.

But the only easy way for me to reproduce it is just compiling jacorb
(www.jacorb.org) on releng_6 (about ten days old) using libthr : after
a while java hangs (can only be killed by -9) and 'top -H' shows three
threads each taking 70-90% CPU-time.

If I take a 'gcore' snapshot of it (dunno how trustful that is)
it shows all threads in _thr_umtx_wait() (script-log attached).

But :

  - only 2x2 smp-amd64 releng_6, 1x2 smp goes OK
  - only easy to produce when using optimized VM (I'll retry
    harder to produce a hang with java_g)
  - no prob on releng_7 (2x2 smp included) for this test

This is thin, but all I have for now ...

Thanx, Arno

-------------- next part --------------
A non-text attachment was scrubbed...
Name: java_thr.script
Type: application/octet-stream
Size: 37654 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-java/attachments/20071203/917ac286/java_thr.obj


More information about the freebsd-java mailing list