Bug 1000295

Summary: Concurrent modif. exc. in drools fire until halt thread during undeployment
Product: [JBoss] JBoss Fuse Service Works 6 Reporter: Martin Vecera <mvecera>
Component: Rules / jBPM integrationAssignee: David Ward <dward>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Vecera <mvecera>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.0.0 GACC: kbabo, soa-p-jira
Target Milestone: ER3   
Target Release: 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
SOA-P 6.0 ER1, the last build of ER1
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Reproducer QS none

Description Martin Vecera 2013-08-23 06:36:42 UTC
When starting a SY app. with Drools service that is configured as FIRE_UNTIL_HALT a new daemon thread is started. During undeployment, when the working memory is being cleared, this thread is still running and conflicts with this operation, which leads to

08:14:22,467 ERROR [org.switchyard.deploy.internal.Deployment] (MSC service thread 1-3) Error stopping service.: java.util.ConcurrentModificationException
	at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:394) [rt.jar:1.7.0_25]
	at java.util.LinkedHashMap$KeyIterator.next(LinkedHashMap.java:405) [rt.jar:1.7.0_25]
	at org.switchyard.component.common.knowledge.session.KnowledgeDisposer.dispose(KnowledgeDisposer.java:51)
	at org.switchyard.component.common.knowledge.exchange.KnowledgeExchangeHandler.disposeStatefulSession(KnowledgeExchangeHandler.java:176)
	at org.switchyard.component.common.knowledge.exchange.KnowledgeExchangeHandler.doStop(KnowledgeExchangeHandler.java:215)
	at org.switchyard.deploy.BaseServiceHandler.stop(BaseServiceHandler.java:90)
	at org.switchyard.deploy.internal.Deployment.undeployImplementations(Deployment.java:647)
	at org.switchyard.deploy.internal.Deployment.stop(Deployment.java:165)
	at org.switchyard.as7.extension.deployment.SwitchYardDeployment.stop(SwitchYardDeployment.java:118) [switchyard-deploy-jboss-as7-1.1.0.M1-redhat-1.jar:1.1.0.M1-redhat-1]
	at org.switchyard.as7.extension.services.SwitchYardService.stop(SwitchYardService.java:88) [switchyard-deploy-jboss-as7-1.1.0.M1-redhat-1.jar:1.1.0.M1-redhat-1]
	at org.jboss.msc.service.ServiceControllerImpl$StopTask.stopService(ServiceControllerImpl.java:1911) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
	at org.jboss.msc.service.ServiceControllerImpl$StopTask.run(ServiceControllerImpl.java:1874) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
	at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]

This possibly leads to the thread running forever, which has bad effect on system resources.

Steps to reproduce:
Open quickstarts/switchyard/rules-camel-cbr/src/main/resources/META-INF/switchyard.xml and change EXECUTE to FIRE_UNTIL_HALT
cd to quickstarts/switchyard/rules-camel-cbr
mvn clean install
mvn -Dtest=RulesCamelCBRTest test

The modified QS is attached as well.

Comment 1 Martin Vecera 2013-08-23 13:40:49 UTC
Created attachment 789603 [details]
Reproducer QS

Comment 2 JBoss JIRA Server 2013-09-09 01:44:42 UTC
David Ward <dward> made a comment on jira SWITCHYARD-1690

https://github.com/jboss-switchyard/components/pull/562

I was able to recreate this bug sometimes (~25% of the time) before the fix.  Now I can't recreate it at all, no matter how many times I try.

Comment 3 JBoss JIRA Server 2013-09-10 13:10:15 UTC
Keith Babo <kbabo> made a comment on jira SWITCHYARD-1690

pushed

Comment 7 Martin Vecera 2013-12-21 14:16:41 UTC
Verified in ER7-2.

Comment 8 JBoss JIRA Server 2014-06-16 23:51:38 UTC
Keith Babo <kbabo> updated the status of jira SWITCHYARD-1690 to Closed