Discussion:
[openjms-developer] [ openjms-Bugs-1107742 ] Clock Daemon Thread never exits in Applet
SourceForge.net
2005-03-25 13:24:08 UTC
Permalink
Bugs item #1107742, was opened at 2005-01-23 23:32
Message generated for change (Comment added) made by tanderson
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1107742&group_id=54559

Category: client
Group: v0.7.6.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Tim Anderson (tanderson)
Assigned to: Jim Alateras (jalateras)
Summary: Clock Daemon Thread never exits in Applet

Initial Comment:
[Originally from
http://article.gmane.org/gmane.comp.java.openjms.use
r/2231 ]

In an applet environment, the Clock daemon thread
raises the following stack traces when the applet is
exited:

SEVERE: Internal error in clock daemon
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at org.exolab.jms.util.Clock.run(Clock.java:210)

followed closely by:

SEVERE: Internal error in clock daemon
java.lang.ThreadDeath
at java.lang.Thread.stop(Thread.java:630)
at java.lang.ThreadGroup.stopOrSuspend
(ThreadGroup.java:633)
at java.lang.ThreadGroup.stop
(ThreadGroup.java:547)
at sun.awt.AppContext.dispose(AppContext.java:411)
at sun.applet.AppletClassLoader.release
(AppletClassLoader.java:668)
at sun.plugin.security.PluginClassLoader.release
(PluginClassLoader.java:407)
at sun.applet.AppletPanel.release
(AppletPanel.java:168)
at sun.applet.AppletPanel.sendEvent
(AppletPanel.java:265)
at sun.plugin.AppletViewer.onPrivateClose
(AppletViewer.java:834)
at sun.plugin.AppletViewer$1.run
(AppletViewer.java:796)
at java.lang.Thread.run(Thread.java:534)


To make matters worse, once this error is raised
dumping the running threads shows this (after
numerous runs):
Dump thread list ...
Group main,ac=20,agc=10,pri=10
main,5,alive
AWT-Motif,6,alive,dameon
AWT-Shutdown,5,alive
Thread-1,5,alive
Thread-2,5,alive
AWT-EventQueue-0,6,alive
Group Plugin Thread Group,ac=4,agc=0,pri=10
Main Console Writer,6,alive
AWT-EventQueue-1,6,alive
Java2D Disposer,10,alive,dameon
TimerQueue,5,alive,dameon
Group http://myserver/myappletpage/-
threadGroup,ac=1,agc=0,pri=4
Clock Daemon,4,alive,dameon
Group http://myserver/myappletpage/-
threadGroup,ac=1,agc=0,pri=4
Clock Daemon,4,alive,dameon
Group http://myserver/myappletpage/-
threadGroup,ac=1,agc=0,pri=4
Clock Daemon,4,alive,dameon
...

Which also causes the memory to never be released.
Obviously some object is being referenced by this
running thread which causes JMS to never release
memory - as evidenced by this:

Garbage collect ... completed.
Memory: 47,368K Free: 21,342K (45%) ... completed.

Looking at the code for "org.exolab.jms.util.Clock" - the
run() method has no safe exit condition, running in
a "while(true)" block........... I assume that this causes
the ThreadDeath exception - which in turn could cause
the Applet code to stop destroying the thread group -
thus keeping objects references which should be gone.
A simple thread exit condition here may fix this.

Ken M.



----------------------------------------------------------------------
Comment By: Tim Anderson (tanderson)
Date: 2005-03-26 00:24

Message:
Logged In: YES
user_id=557161

Fixed in CVS. Fix will be available in the 0.7.7 release.

----------------------------------------------------------------------

Comment By: Tim Anderson (tanderson)
Date: 2005-01-23 23:33

Message:
Logged In: YES
user_id=557161

Changing the Clock code so that run() looks something like:

while (true) {
try {
for (int i = 0; i < _synchEvery; ++i) {
sleep(_unsynchTicks);
synchronized (Clock.class) {
_clock += _unsynchTicks + _adjust;
}
}
synchronize();
} catch (ThreadDeath exception) {
_log.debug("clock daemon terminating",
exception);
throw exception;
} catch (Throwable exception) {
_log.error("Internal error in clock daemon",
exception);
}
}

should correct the problem.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1107742&group_id=54559
Loading...