elzaksspro / gstreamer-java

Automatically exported from code.google.com/p/gstreamer-java
0 stars 0 forks source link

Gst executor thread dies prematurely when used inside an applet #18

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Build a gstreamer-java based applet
2. The applet calls Gst.init(), if Gst is not yet initialized, from inside
applet's init()
3. Destroy applet (e.g. by setting applet element style to display: none or
reloading/closing page)

What is the expected output? What do you see instead?
----------------------------------------------------

After any Gst based applet is destroyed, other Gst based applets stop
functioning. IllegalMonitorStateException is thrown from a generic Java
class without the stack trace pointing to any gstreamer-java specific code.

What version of the product are you using? On what operating system?
-------------------------------------------------------------------

gstreamer-java 0.7, native gstreamer core 0.10.17.

Please provide any additional information below.
------------------------------------------------

I think the problem is a side effect of the Java applet life-cycle
mechanism: When an applet is destroyed, any threads belonging the it's
AppletThreadGroup are interrupted then killed (remember this Thread.stop()
method we were told to never, never use?). This is how executor threads
never meant to die inside Gst.java are also thusly terminated rendering Gst
unusable. 

Fix/Work arround:
----------------
Changing code in Gst.java to attach executor threads to main thread group
instead of applet's thread group seems to solve the problem (see patch)

Original issue reported on code.google.com by tsha...@gmail.com on 24 Jun 2008 at 12:01

Attachments:

GoogleCodeExporter commented 8 years ago
I've implemented something similar to the supplied patch, and also made 
Gst.init/Gst.deinit() pair up, so you can 
call Gst.init() in Applet.init() and Gst.deinit() in Applet.destroy() for each 
applet.

Please test the latest source and see if it works.

Original comment by wmeiss...@gmail.com on 24 Jun 2008 at 3:53

GoogleCodeExporter commented 8 years ago
I have tested the patch and it works fine - at least in regards to the 
Thread.stop()
issue. I will modify my code to test the new init/deinit reference counting 
provided
by your patch. Thank

Original comment by tsha...@gmail.com on 25 Jun 2008 at 3:00

GoogleCodeExporter commented 8 years ago
Stopping with a debugger init/deinit ref counting seems to work. With multiple
gstreamer-applets running simultaneously though, it looks to me like a call to
Applet.destroy is not always guaranteed, leaving Gst initialized. Leaving Gst
initialized is something I can live with.

Testing completed.

Original comment by tsha...@gmail.com on 25 Jun 2008 at 5:06

GoogleCodeExporter commented 8 years ago
You seem to be happy with it, so marking as fixed.

Original comment by wmeiss...@gmail.com on 16 Jul 2008 at 3:10