[
https://issues.jboss.org/browse/DROOLS-458?page=com.atlassian.jira.plugin...
]
Desmond Silveira updated DROOLS-458:
------------------------------------
Attachment: la3ldspg05b.txt
I have attached the full thread dump.
There are 129 blocked threads.
72 are blocked by lock <219dcd77> which is owned by thread
http-bio-172.16.216.19-80-exec-37511.
57 are blocked by lock <555896b3> which is owned by thread
http-bio-172.16.216.19-80-exec-37519.
Both of those threads are in a runnable state executing drools code.
In my other Tomcat instances that execute the same code, none of my threads are blocked.
I recently upgraded to Drools 6.0.1 from Drools 5.0. Other than this library upgrade (and
corresponding changes to library calls) and marked increase in traffic, I haven't had
any other changes to my system recently, but my threads have been deadlocking over the
past couple of weeks.
Drools lock in StatelessKnowledgeSessionImpl.
---------------------------------------------
Key: DROOLS-458
URL:
https://issues.jboss.org/browse/DROOLS-458
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 6.0.1.Final
Environment: Tomcat 7
Reporter: Desmond Silveira
Assignee: Mario Fusco
Attachments: la3ldspg05b.txt
My Tomcat HTTP BIO connector threads (129 of them) got BLOCKED in my production Tomcat 7
instance because Drool 6.0.1 wasn't releasing a lock.
Here is a snippet of the thread dump:
{noformat}
"http-bio-172.16.216.19-80-exec-37513" - Thread t@6245360
java.lang.Thread.State: BLOCKED
at
org.drools.core.runtime.process.ProcessRuntimeFactory.getProcessRuntimeFactoryService(ProcessRuntimeFactory.java:20)
- waiting to lock <219dcd77> (a java.lang.Class) owned by
"http-bio-172.16.216.19-80-exec-37511" t@6245358
at
org.drools.core.runtime.process.ProcessRuntimeFactory.newProcessRuntime(ProcessRuntimeFactory.java:12)
at
org.drools.core.common.AbstractWorkingMemory.createProcessRuntime(AbstractWorkingMemory.java:405)
at
org.drools.core.common.AbstractWorkingMemory.setKnowledgeRuntime(AbstractWorkingMemory.java:1770)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.<init>(StatefulKnowledgeSessionImpl.java:125)
at
org.drools.core.impl.StatelessKnowledgeSessionImpl.newWorkingMemory(StatelessKnowledgeSessionImpl.java:139)
at
org.drools.core.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:397)
at com.local.lds.RuleEngineBean.applyKnowledge(RuleEngineBean.java:50)
at com.local.lds.LdsBean.search(LdsBean.java:200)
at com.local.lds.servlet.SearchServlet.doGet(SearchServlet.java:55)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
- locked <3575a054> (a org.apache.tomcat.util.net.SocketWrapper)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Locked ownable synchronizers:
- locked <719df963> (a java.util.concurrent.ThreadPoolExecutor$Worker)
"http-bio-172.16.216.19-80-exec-37511" - Thread t@6245358
java.lang.Thread.State: RUNNABLE
at org.kie.internal.utils.ServiceRegistryImpl.addDefault(ServiceRegistryImpl.java:212)
- locked <3d710637> (a org.kie.internal.utils.ServiceRegistryImpl)
at org.kie.internal.utils.ServiceRegistryImpl.addDefault(ServiceRegistryImpl.java:207)
- locked <3d710637> (a org.kie.internal.utils.ServiceRegistryImpl)
at
org.drools.core.runtime.process.ProcessRuntimeFactory.loadProvider(ProcessRuntimeFactory.java:27)
at
org.drools.core.runtime.process.ProcessRuntimeFactory.getProcessRuntimeFactoryService(ProcessRuntimeFactory.java:21)
- locked <219dcd77> (a java.lang.Class)
at
org.drools.core.runtime.process.ProcessRuntimeFactory.newProcessRuntime(ProcessRuntimeFactory.java:12)
at
org.drools.core.common.AbstractWorkingMemory.createProcessRuntime(AbstractWorkingMemory.java:405)
at
org.drools.core.common.AbstractWorkingMemory.setKnowledgeRuntime(AbstractWorkingMemory.java:1770)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.<init>(StatefulKnowledgeSessionImpl.java:125)
at
org.drools.core.impl.StatelessKnowledgeSessionImpl.newWorkingMemory(StatelessKnowledgeSessionImpl.java:139)
at
org.drools.core.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:397)
at com.local.lds.RuleEngineBean.applyKnowledge(RuleEngineBean.java:50)
at com.local.lds.LdsBean.search(LdsBean.java:200)
at com.local.lds.servlet.SearchServlet.doGet(SearchServlet.java:55)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
- locked <474f2464> (a org.apache.tomcat.util.net.SocketWrapper)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Locked ownable synchronizers:
- locked <339f344e> (a java.util.concurrent.ThreadPoolExecutor$Worker)
"http-bio-172.16.216.19-80-exec-37447" - Thread t@6233953
java.lang.Thread.State: BLOCKED
at org.drools.core.common.ProjectClassLoader.loadClass(ProjectClassLoader.java:82)
- waiting to lock <555896b3> (a org.drools.core.common.ProjectClassLoader) owned
by "http-bio-172.16.216.19-80-exec-37519" t@6245366
at java.lang.ClassLoader.loadClass(Unknown Source)
at
org.drools.core.base.ClassFieldAccessorCache.getClass(ClassFieldAccessorCache.java:122)
at
org.drools.core.base.ClassFieldAccessorCache.getClassObjectType(ClassFieldAccessorCache.java:46)
at org.drools.core.reteoo.ClassObjectTypeConf.<init>(ClassObjectTypeConf.java:89)
at
org.drools.core.common.ObjectTypeConfigurationRegistry.getObjectTypeConf(ObjectTypeConfigurationRegistry.java:71)
at
org.drools.core.common.AbstractWorkingMemory.initInitialFact(AbstractWorkingMemory.java:385)
at
org.drools.core.common.AbstractWorkingMemory.<init>(AbstractWorkingMemory.java:378)
at
org.drools.core.common.AbstractWorkingMemory.<init>(AbstractWorkingMemory.java:261)
at
org.drools.core.common.PhreakWorkingMemoryFactory.createWorkingMemory(PhreakWorkingMemoryFactory.java:15)
at
org.drools.core.impl.StatelessKnowledgeSessionImpl.newWorkingMemory(StatelessKnowledgeSessionImpl.java:134)
at
org.drools.core.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:397)
at com.local.lds.RuleEngineBean.applyKnowledge(RuleEngineBean.java:50)
at com.local.lds.LdsBean.search(LdsBean.java:200)
at com.local.lds.servlet.SearchServlet.doGet(SearchServlet.java:55)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
- locked <57e6b780> (a org.apache.tomcat.util.net.SocketWrapper)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Locked ownable synchronizers:
- locked <726294fc> (a java.util.concurrent.ThreadPoolExecutor$Worker)
"http-bio-172.16.216.19-80-exec-37519" - Thread t@6245366
java.lang.Thread.State: RUNNABLE
at java.lang.ClassLoader.findLoadedClass0(Native Method)
at java.lang.ClassLoader.findLoadedClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
- locked <555896b3> (a org.drools.core.common.ProjectClassLoader)
at
org.drools.core.common.ProjectClassLoader.internalLoadClass(ProjectClassLoader.java:99)
at org.drools.core.common.ProjectClassLoader.loadClass(ProjectClassLoader.java:82)
- locked <555896b3> (a org.drools.core.common.ProjectClassLoader)
at java.lang.ClassLoader.loadClass(Unknown Source)
at
org.drools.core.base.ClassFieldAccessorCache.getClass(ClassFieldAccessorCache.java:122)
at
org.drools.core.base.ClassFieldAccessorCache.getClassObjectType(ClassFieldAccessorCache.java:46)
at org.drools.core.reteoo.ClassObjectTypeConf.<init>(ClassObjectTypeConf.java:89)
at
org.drools.core.common.ObjectTypeConfigurationRegistry.getObjectTypeConf(ObjectTypeConfigurationRegistry.java:71)
at org.drools.core.common.NamedEntryPoint.insert(NamedEntryPoint.java:164)
at org.drools.core.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1148)
at org.drools.core.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1092)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:308)
at
org.drools.core.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:400)
at com.local.lds.RuleEngineBean.applyKnowledge(RuleEngineBean.java:50)
at com.local.lds.LdsBean.search(LdsBean.java:200)
at com.local.lds.servlet.SearchServlet.doGet(SearchServlet.java:55)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
- locked <43c2901> (a org.apache.tomcat.util.net.SocketWrapper)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Locked ownable synchronizers:
- locked <88f8fa9> (a java.util.concurrent.ThreadPoolExecutor$Worker)
{noformat}
Here is the code that I use to call Drools:
{code:java}
public static Collection<ResultSet> applyRule(String rule,
KieBase kb, Collection<ResultSet> resultSets, SearchParameters params)
{
try {
if (kb == null) {
return resultSets;
}
StatelessKieSession ksession = kb.newStatelessKieSession();
ksession.setGlobal(OUTPUT, new ArrayList<>());
Collection<Object> collection = new
ArrayList<Object>(resultSets);
collection.add(params);
ksession.execute(collection);
return (Collection<ResultSet>) ksession.getGlobals().get(OUTPUT);
} catch (ConsequenceException e) {
LOG.error("Error in rule: " + rule + " " + e.getRule(),
e);
throw e;
} catch (RuntimeException e) {
LOG.error("Error in rule: " + rule, e);
throw e;
}
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira