You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ThreadPool deconstruction hangs on 'condition_consumers.notify_all();'
I am using log4cplus as part of my C++ library.
I have JNI bindings to provide usage of my library through Java
The Java app does a load library for linkage with my C++ app
When the Java app finishes, and deconstructs everything, the jvm hangs and will not exit
If I comment out the condition_consumers.notify_all(); line, everything deconstructs and the jvm exits
This only occurs when I build log4cplus on windows 10 using mingw-64
(msvc 2015,2017, osx clang, ubuntu gcc all deconstruct fine)
I have not had any issues with native C++ applications built with mingw hanging at program deconstruction, but I will confirm this and ensure the ThreadPool dtor does indeed complete. (I assume it will, and this is some weird JVM/mingw thread disagreement)
To reproduce this,
I pulled 5ce831b
Using cmake 3.8.1, I turned off WITH_UNIT_TESTS, LOGGINGSERVER, TESTING, DECORATION
I built the log4cplus.dll using mingw-64 version 8.1 and 7.3 from the latest mingw-w64 download from sourceforge
I then run this simple Java (Java x64 1.8.0_131) program:
package kitware.physiology.pulse;
public class QuickLoad
{
public static void main(String[] args)
{
System.load("C:/Programming/builds/log4cplus-mingw7/bin/liblog4cplus.dll");
//System.load("C:/Programming/builds/log4cplus-mingw8/bin/liblog4cplus.dll");
System.out.println("I am done!");
}
}
I am running this simple driver via eclipse neon, and the jvm never exits
I am not calling the initialize logger or anything, just loading the dll and exiting
This is on my Surface Pro 3, x64,
(Note other users have reported this, not sure about their platform other than mingw on windows 7)
The text was updated successfully, but these errors were encountered:
Confirmed a C++ native application compiled with mingw has no issues in deconstruction
Seems to be something due to running inside a JVM (also update to 1.8_181)
This is likely because it does not get deinitialized properly. It initializes automatically but the deinitialization has to happen outside DllMain() on some platform combinations. Please try to deinitialize it by creating log4cplus::Initializer instance and make sure it is deleted or destroyed before your try to unload the DLL.
I just took a look at the code and it seems to me this is currently the only way. I should probably add a log4cplus::deinitialize() counterpart for the log4cplus::initialize() to make the deinitialization possible without the log4cplus::Initializer instance.
This is working great!
There are sometimes when I load my library and don't create an Initializer
so this is exactly what I needed
I just added this to my JNI clean up interface and everything is shutting down fine now
Thanks for the quick support!
The ThreadPool deconstruction hangs on 'condition_consumers.notify_all();'
I am using log4cplus as part of my C++ library.
I have JNI bindings to provide usage of my library through Java
The Java app does a load library for linkage with my C++ app
When the Java app finishes, and deconstructs everything, the jvm hangs and will not exit
If I comment out the condition_consumers.notify_all(); line, everything deconstructs and the jvm exits
This only occurs when I build log4cplus on windows 10 using mingw-64
(msvc 2015,2017, osx clang, ubuntu gcc all deconstruct fine)
I have not had any issues with native C++ applications built with mingw hanging at program deconstruction, but I will confirm this and ensure the ThreadPool dtor does indeed complete. (I assume it will, and this is some weird JVM/mingw thread disagreement)
To reproduce this,
I pulled 5ce831b
Using cmake 3.8.1, I turned off WITH_UNIT_TESTS, LOGGINGSERVER, TESTING, DECORATION
I built the log4cplus.dll using mingw-64 version 8.1 and 7.3 from the latest mingw-w64 download from sourceforge
I then run this simple Java (Java x64 1.8.0_131) program:
I am running this simple driver via eclipse neon, and the jvm never exits
I am not calling the initialize logger or anything, just loading the dll and exiting
This is on my Surface Pro 3, x64,
(Note other users have reported this, not sure about their platform other than mingw on windows 7)
The text was updated successfully, but these errors were encountered: