Hi,
I spent four hours on Saturday to debug the very same leak… For now I
patched JRuby, so it ditches terminated threads from the
threadContextMap every once in a while. The leak seems to be fixed. Yes,
I also noticed that ThreadContext refers back to RubyThread, which may
prevent the stuff from being GCed. Is this a pretty nasty JRuby bug?
Here’s how the threads get registered by JRuby-Rack/JMS:
org.jruby.internal.runtime.ThreadService.registerNewThread(ThreadService.java:197)
org.jruby.RubyThread.adoptThread(RubyThread.java:226)
org.jruby.RubyThread.adopt(RubyThread.java:218)
org.jruby.internal.runtime.ThreadService.adoptCurrentThread(ThreadService.java:134)
org.jruby.internal.runtime.ThreadService.getCurrentContext(ThreadService.java:116)
org.jruby.Ruby.getCurrentContext(Ruby.java:2185)
org.jruby.gen.InterfaceImpl834654122.getApplication(org/jruby/gen/InterfaceImpl834654122.gen:12)
org.jruby.rack.jms.DefaultQueueManager$RubyObjectMessageListener.onMessage(DefaultQueueManager.java:127)
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1021)
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:122)
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:192)
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
java.lang.Thread.run(Thread.java:637)
Christian
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email