Bug 1310908

Summary: [GSS](6.4.z) EJBs accessible too early (spec violation)
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: dereed
Component: EJBAssignee: Fedor Gavrilov <fgavrilo>
Status: CLOSED CURRENTRELEASE QA Contact: Jan Martiska <jmartisk>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4.6CC: bbaranow, bmaxwell, cdewolf, david.lloyd, fgavrilo, ivassile, jbilek, jtruhlar, lakagwu, msochure, vtunka
Target Milestone: CR1   
Target Release: EAP 6.4.9   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1350355 (view as bug list) 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:    
Bug Blocks: 1324262, 1350355, 1366526    
Attachments:
Description Flags
test.zip
none
auto-test-reproducer.zip - just deploy jars and it will log an error and stacktrace if issue occurs none

Description dereed 2016-02-22 23:43:22 UTC
EJB 3.1 spec, section 4.8.1:
    "If the Startup annotation appears on the Singleton bean class or if the Singleton has been designated via the deployment descriptor as requiring eager initialization, the container must initialize the Singleton bean instance during the application startup sequence. The container must initialize all such startup-time Singletons before any external client requests (that is, client requests originating outside of the application) are delivered to any enterprise bean components in the application.

EAP does not implement this correctly, and allows calls to other EJBs before a @Startup @Singleton finishes its @PostConstruct call.

Comment 1 dereed 2016-02-22 23:50:12 UTC
Attached test case, test.zip.

Deploy both singleton.jar and client.war.
Start EAP.

The @Singleton's @PostConstruct will log to stdout "starting pause" and sleep.
Hit client.war -- http://localhost:8080/client/ which accesses another bean in single
ton.war.

Expected: EJB call waits until @PostConstruct finishes.
Actual: EJB call completes immediately (logs to stdout "Singleton TestBean").

Comment 2 dereed 2016-02-22 23:50:55 UTC
Created attachment 1129567 [details]
test.zip

Comment 7 dereed 2016-02-23 21:42:21 UTC
Workaround: Add @DependsOn("SingletonEJBName"), or @DependsOn("ejb.jar#SingletonEJBName") for separate modules in an ear, to each EJB for each singleton it needs to wait on.

Comment 9 Brad Maxwell 2016-03-17 16:32:58 UTC
Created attachment 1137443 [details]
auto-test-reproducer.zip - just deploy jars and it will log an error and stacktrace if issue occurs

Comment 13 JBoss JIRA Server 2016-04-05 03:56:21 UTC
Fedor Gavrilov <fgavrilo> updated the status of jira WFLY-6402 to Coding In Progress

Comment 19 JBoss JIRA Server 2016-06-08 09:24:57 UTC
Fedor Gavrilov <fgavrilo> updated the status of jira WFLY-6402 to Coding In Progress

Comment 20 JBoss JIRA Server 2016-06-08 09:25:06 UTC
Fedor Gavrilov <fgavrilo> updated the status of jira WFLY-6402 to Open

Comment 21 JBoss JIRA Server 2016-06-08 09:25:52 UTC
Fedor Gavrilov <fgavrilo> updated the status of jira WFLY-6402 to Resolved

Comment 29 JBoss JIRA Server 2016-06-24 15:38:13 UTC
Fedor Gavrilov <fgavrilo> updated the status of jira WFLY-6402 to Reopened

Comment 31 Jiří Bílek 2016-06-29 08:52:56 UTC
test.zip works
auto-test-reproducer.zip does not work (https://bugzilla.redhat.com/show_bug.cgi?id=1350355)
Verified with EAP 6.4.9.CP.CR2

Comment 32 Petr Penicka 2017-01-17 12:58:57 UTC
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.

Comment 33 Petr Penicka 2017-01-17 12:58:59 UTC
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.

Comment 34 Petr Penicka 2017-01-17 13:00:52 UTC
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.