Re: [Quickfix-developers] PATCH - Java crashes solved
Brought to you by:
orenmnero
From: Joerg T. <Joe...@ma...> - 2003-05-02 09:03:34
|
Hi Alex, > This is vital for the JVM, as if a thread is created in C++ via > pthread_create() the JVM won't return an environment for it from > ENV::get(). This was the cause of a lot out our java crashes, as when > the environment is unknown a null pointer is returned (and then used). Oren is right: There is no general problem using POSIX threads since the JVM also creates its threads using the POSIX API. As Oren already stated, the JNI calls AttachCurrentThread and DetachCurrentThread attach and detach the POSIX thread to some JVM specific data structures. This is done using thread local data und pthread_setspecific() and related calls. We are using a mixture of Java and native threads for some years both on Linux and on Solaris. Once there was a problem with AttachCurrentThread which appears as a thread registered a second time. We simply solved this by wrapping every block of Java usage into Attach/Detach calls. This imposes some overhead, but solved the crashes. In addition, using /usr/lib/lwp on Solaris is *always* the Right Thing. Alex, could provide some more information about your crashes: Operating System, Java version, crash log file. Perhaps I have some ideas. BTW, thanks for the couple of patches you posted recently. Since I use the UNIX version, these improvements also help us. Cheers, Jörg -- Joerg Thoennes http://macd.com Tel.: +49 (0)241 44597-24 Macdonald Associates GmbH Fax : +49 (0)241 44597-10 Lothringer Str. 52, D-52070 Aachen |