bluegitter / xmemcached

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

hanged threads of the memcached client after shutdown of tomcat #262

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.startup the tomcat , and shutdown .
2.in the web app i use memcached client 1.4.2 with hazelcast server nodes .
3.in the contextDestroyed of the app i do memcachedClient.shutdown()

What is the expected output? What do you see instead?
the tomcat process can't shutdown 

What version of the product are you using? On what operating system?
memcached client 1.4.2
on OS :
Linux 2.6.32-220.el6.x86_64 #1 SMP Sat Dec 10 17:04:11 CST 2011 x86_64 x86_64 
86_64 GNU/Linux

Please provide any additional information below.
got the following log in catalina.out :
SEVERE: The web application [/xxx] appears to have started a thread named 
[Xmemcached-Reactor-0] but has failed to stop it. This is very likely to create 
a memory leak.
Aug 12, 2013 12:28:49 AM org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [/xxx] appears to have started a thread named 
[Xmemcached-Reactor-1] but has failed to stop it. This is very likely to create 
a memory leak.
Aug 12, 2013 12:28:49 AM org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [/xxx] appears to have started a thread named 
[Heal-Session-Thread] but has failed to stop it. This is very likely to create 
a memory leak.
Aug 12, 2013 12:28:49 AM org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [/xxx] appears to have started a thread named 
[pool-1-thread-1] but has failed to stop it. This is very likely to create a 
memory leak.

Original issue reported on code.google.com by ynotfrie...@gmail.com on 11 Aug 2013 at 1:40

GoogleCodeExporter commented 9 years ago
I am experiencing this exact same issue. Tomcat 7.0.42 built from source, 
CentOS 6.4, x86_64. Java 1.7u25, also 64-bit.

Linux hostname 2.6.32-358.14.1.el6.x86_64 #1 SMP Tue Jul 16 23:51:20 UTC 2013 
x86_64 x86_64 x86_64 GNU/Linux

When I attempt to shutdown Tomcat, the process does not fully terminate. Some 
ports are left listening and there is a lingering connection to memcached. I 
have to manually issue a kill command to finish off the process.

I'm attaching a thread dump from Tomcat when it is in this state.

Original comment by jhenr...@gmail.com on 30 Aug 2013 at 2:53

Attachments:

GoogleCodeExporter commented 9 years ago
Any update on this issue?

Original comment by a...@noknok.com on 15 Oct 2013 at 2:14

GoogleCodeExporter commented 9 years ago
Do you call memcachedClient.shutdown() before shutting down tomcat?

If you are using spring framework,you should configure destroy-method for the 
memcached client.

Original comment by killme2...@gmail.com on 27 Oct 2013 at 7:44

GoogleCodeExporter commented 9 years ago
Please upgrade to 1.4.2,the reactor threads are daemon now.

Original comment by killme2...@gmail.com on 27 Oct 2013 at 8:03

GoogleCodeExporter commented 9 years ago
To  Project Member #4 killme2...@gmail.com
Please upgrade to 1.4.2,the reactor threads are daemon now.

are you sure? I downloaded the src of 1.4.3, but it seems it's not set to 
daemon.

SelectorManager.java:
line:58
for (Reactor reactor : reactorSet) {
            reactor.start();
        }

and i modified the source , insert reactor.setDaemon(true) before 
reactor.start().
but i doesn't work, too.

:(   any suggestions???

Original comment by kittaa...@gmail.com on 18 Nov 2013 at 8:27

GoogleCodeExporter commented 9 years ago
I found the problem source.

in   net.rubyeye.xmemcached.impl.MemcachedHandler  line 306
the heartBeatThreadPool launch a thread and set Daemon to false and set the 
priority.
I don't known why you set this two properties. but it seems no problem to set 
the thread to daemon. I set the thread to daemon and priority to 
Thread.MIN_PRIORITY. Then my tomcat shutdown gracefully.

Great admiration to all your work.

If there is some reasons that i should not (or can not) do this modification, 
it's greatly appreciated to let me known.
my email: kittaaron@gmail.com  or liuhuiyu5201413@163.com

Original comment by kittaa...@gmail.com on 19 Nov 2013 at 9:19