tomasbilek / gwteventservice

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

UserActivityScheduler.myTimer should be a daemon thread #17

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Deploy a GWT eventservice application in Tomcat. Stop Tomcat. Tomcat freezes

What is the expected output? What do you see instead?
Tomcat should not freeze :-)

What version of the product are you using? On what operating system?
GWT 2.0.3
Ubuntu 9.10 <-- this might be important, problem might not reproduce with
windows
Firefox
GWT Eventservice 1.1.1

Please provide any additional information below.

Tomcat will not shutdown if there are still non-daemon threads around, see
http://wiki.apache.org/tomcat/FAQ/Miscellaneous#Q25

By calling new Timer() UserActivityScheduler is creating a non-daemon thread.

Solution a)
I solved the problem by issuing the following command when my application
shuts down:

UserManagerFactory.getInstance().getUserManager().deactivateUserActivitySchedule
r();

Is there a dedicated shutdown hook for GWT eventservice I should call? I
searched the documentation and hello world example but found nothing. I
prefer the other solution in case someone forgets to call the hook anyways.

Solution b)
Change UserActivityScheduler:89 to:

myTimer = new Timer("GWT Eventservice UserActivityScheduler", true);

The second parameter sets the TimerThread to daemon (I think there is no
disadvantage, but I'm no concurrency wizard), the first will change the
name of the Thread, which per default is "Timer-0" to simplify debugging.

In the current version the Thread will display as follows in the stacktrace:

"Timer-0" prio=10 tid=0x76c29c00 nid=0x21dc in Object.wait() [0x7719d000]

After the change, the Thread will display like this:

"GWT Eventservice UserActivityScheduler" daemon prio=10 tid=0x756e9800
nid=0x1ca5 in Object.wait() [0x76bd0000]

which makes it easier to identify the thread.

If you decide for solution b) you might want to check if you create more
threads in other parts of the library that i happen to not use.

--Jens

Original issue reported on code.google.com by jeeens.g...@googlemail.com on 22 Apr 2010 at 10:32

GoogleCodeExporter commented 8 years ago
It isn't reproduceable with Windows, but it makes sense to start the thread as a
daemon thread. That will be solved with GWTEventService 1.2 or with 
GWTEventService
1.1.2 (when more bugs need to be fixed immediately).

Original comment by sven.strohschein@googlemail.com on 24 Apr 2010 at 1:11

GoogleCodeExporter commented 8 years ago
It is fixed in the trunk version (1.2) with solution 2 (daemon thread).

@Jens: Could you please verify that on your system so the ticket can be closed?

Original comment by sven.strohschein@googlemail.com on 21 Jun 2010 at 9:48

GoogleCodeExporter commented 8 years ago
I can confirm that 1.2 fixes the bug. Thx for the quick fix!

Jens Göring

Original comment by jeeens.g...@googlemail.com on 22 Jun 2010 at 9:04

GoogleCodeExporter commented 8 years ago
Marked as verified. Thanks to Jens Göring.

Original comment by sven.strohschein@googlemail.com on 23 Jun 2010 at 11:12