jdk14 & libc_r / fork()

Alexey Zelkin phantom at FreeBSD.org.ua
Sun Aug 24 14:13:39 PDT 2003


I have hit into a problem recently while trying to reproduce
some deadlocks in jdk14 port.  Problem details are simple --
JDK calls fork() and got frozen because of storm of unhandled
(i.e. ignored SIGBUSes).  I have checked that SIGBUS ignorance
is not a problem, but reason of SIGBUS is.

Some investigations shown that while doing of libc_r's wrapper
for fork() we try to cleanup pthread's stacks.  Since we are
using custom stacks in JVM (malloc()'ed ones) libc_r attempts
to free() them.  Most times everything goes right, but sometimes
(very rarely) SIGBUS is being generated while free()'ing of stacks.

more details: it's RELENG_4
from trace (sorry, i accidiently deleted complete trace), but
from memory can restore following points:

libc_r/uthread/uthread_fork.c:154 -- <free() called here>
libc/stdlib/malloc.c:606 -- <KABOOM here>

Any ideas on reasons ?

PS: BTW, it's looks very similar to "red zone" violation in protection,
but since problem appears after __sys_fork() call - it should not be
a problem.  Am I right ?

More information about the freebsd-threads mailing list