[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjms-developer
Subject:    [openjms-developer] [ openjms-Bugs-1107742 ] Clock Daemon Thread never exits in Applet
From:       "SourceForge.net" <noreply () sourceforge ! net>
Date:       2005-01-23 12:33:36
Message-ID: E1Csgvw-0006yk-OF () sc8-sf-web4 ! sourceforge ! net
[Download RAW message or body]

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Ūtail&atidG4136&aid07742&group_idT559

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 ,agc,pri
    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
    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-01-23 23:33

Message:
Logged In: YES
user_idU7161

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Ūtail&atidG4136&aid07742&group_idT559


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
openjms-developer mailing list
openjms-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openjms-developer
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic