Bug 1126683

Summary: QueuelessExecutor may not run listener when workers were active during shutdown
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: James Livingston <jlivings>
Component: OtherAssignee: John Allen <joallen>
Status: CLOSED CURRENTRELEASE QA Contact: Pavel Slavicek <pslavice>
Severity: high Docs Contact: eap-docs <eap-docs>
Priority: urgent    
Version: 6.3.0CC: david.lloyd, joallen, kkhan, lthon
Target Milestone: DR8   
Target Release: EAP 6.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
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:
Embargoed:
Bug Depends On: 1159002    
Bug Blocks:    

Description James Livingston 2014-08-05 05:20:57 UTC
If there are threads running when QueuelessExecutor.shutdown() is called, it does not call shutdownListenable.shutdown() and relies on the handling in Worker.run() to invoke that once the last thread has shut down.

https://github.com/jbossas/jboss-threads/blob/master/src/main/java/org/jboss/threads/QueuelessExecutor.java#L673 will set the flag to invoke it if the conditions are met. That logic is defeated by https://github.com/jbossas/jboss-threads/blob/master/src/main/java/org/jboss/threads/QueuelessExecutor.java#L632, which will remove the thread first causing the remove call in the finally block to always return false and so not set the last flag.

Comment 1 James Livingston 2014-08-06 22:54:38 UTC
https://github.com/jbossas/jboss-threads/pull/11 is for the 2.1 branch, which is what we'd want to pull in to fix in the product.

Comment 2 JBoss JIRA Server 2014-10-13 15:34:59 UTC
David Lloyd <david.lloyd> updated the status of jira JBTHR-28 to Resolved

Comment 3 James Livingston 2014-10-13 22:25:55 UTC
Fix will be in the jboss-threads 2.1.2 release.

Comment 4 Ladislav Thon 2014-11-14 11:34:09 UTC
Verified with EAP 6.4.0.DR9.

Very easy to reproduce using the reproducer from JBTHR-29 (which is in fact a duplicate of JBTHR-28).