gavgaurav / nativelibs4java

Automatically exported from code.google.com/p/nativelibs4java
0 stars 0 forks source link

BridJ: COM deadlock on application exit: CoUninitialize() called from wrong thread? #75

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
First, have you checked out the FAQ
(http://code.google.com/p/nativelibs4java/wiki/FAQ) and Build instructions
(http://code.google.com/p/javacl/wiki/Build) ?
Yes.

Have you looked at NativeLibs4Java's user group's archive ?
(http://groups.google.com/group/nativelibs4java)
Yes.

What steps will reproduce the problem?
1. Create any COM object on Windows XP.
2. Call Release() on it or not, it doesn't matter.
3. Let control leave your public static void main().

What is the expected output? What do you see instead?
It is expected that the application will exit when it leaves main(). It doesn't 
exit. Attempting to stack trace it with jstack causes jstack to also lock up 
without giving any output.

What version of the product are you using? On what operating system?
JDK 1.6.0_26 on Windows XP.

If the JVM crashes, please attach the  hs_err_pidXXX.log crash report file
written by the JVM.
It doesn't crash.

Please provide any additional information below.
When I install Java in Wine, and run the code with the +ole debug channel in 
that setup, I see that CoUninitialize() is called from the wrong thread. I 
think this is because the finalizer thread calls the finalize() method of 
COMRuntime's comInitializer object, which is not the thread that called 
CoInitializeEx(). I tried to patch COMRuntime to expose CoInitialize[Ex]() and 
CoUninitialize() in its public API and not use the comInitializer object, and 
calling these methods manually in the same thread fixes the problem. The patch 
is attached, but sadly this is an API breaking change.

Original issue reported on code.google.com by damjan....@gmail.com on 4 Jul 2011 at 5:21

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry the product version was both 0.4.2 and SVN HEAD.

Original comment by damjan....@gmail.com on 4 Jul 2011 at 5:01

GoogleCodeExporter commented 9 years ago
Hello,

Thanks a lot for your report and patch !
I'll look into this ASAP...
Cheers
--
zOlive

Original comment by olivier.chafik@gmail.com on 4 Jul 2011 at 11:19

GoogleCodeExporter commented 9 years ago

Original comment by olivier.chafik@gmail.com on 4 Jul 2011 at 11:19

GoogleCodeExporter commented 9 years ago
Hi,
This issue moved to Github :
https://github.com/ochafik/nativelibs4java/issues/77

Thanks for not updating this page anymore and adding further comments on Github.
Cheers
--
zOlive

Original comment by olivier.chafik@gmail.com on 1 Sep 2011 at 7:29

GoogleCodeExporter commented 9 years ago

Original comment by olivier.chafik@gmail.com on 1 Sep 2011 at 7:30