Subject: Native NetBSD jdk package problems
To: None <firstname.lastname@example.org>
From: Arto Huusko <email@example.com>
Date: 03/03/2005 22:53:35
I just compiled and installed jdk14 package from pkgsrc-wip on
NetBSD -current (2.99.12) and as you've listed as the maintainer,
I'll report this one to you (and CC mailing list, as this might
interest others, too). Though this is really a bug in java itself
(and just happens to manifest with NetBSD pthreads)... but I hope
you're in a position to add a patch to pkgsrc-wip, at least.
Anyway, there's an uninitialized pthread mutex problem in java's
libcmm. This bug manifests itself at least when using
javax.imageio.ImageIO.read(). And NetBSD pthreads don't seem to
recover even if PTHREAD_DIAGASSERT is set to just report the error.
The offending mutex is in the source file
and the offending line is 815. I fixed the problem by changing the
line to read
static pthread_mutex_t exchangeMutex = PTHREAD_MUTEX_INITIALIZER;
and after that ImageIO.read() works.
There's another problem, but I believe it is caused by NetBSD's
pthreads, not java per se. The problem is that performance truly
sucks if there's one thread doing constant work, and other threads
handling UI. Running under sun-jdk14 with Linux emulation on the
same NetBSD box it even manages to be quite smooth, but with native
jdk the UI is completely unusable.
The situation is such that there's a thread that loads image thumbnails,
and then tells the UI to update so that the thumbnail gets shown; with
sun-jdk, I see each thumbnail appear one by one, and the UI is usable
during this (I can browse the images, I can scale the window size, ...);
with native jdk the UI just stalls completely until all thumbnails have
been loaded -- even window decorations don't get drawn. Oh, and looking at
top, WCPU jumps to 300%.
But, on the other hands, once the loader thread finishes, the UI seems
to be faster and smoother than under sun-jdk14. So it's not all bad.