[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-3652) Major reentrancy problem with "Page Scope" components and injection/disinjection

Denis Forveille (JIRA) jira-events at lists.jboss.org
Mon Nov 10 14:32:36 EST 2008


     [ https://jira.jboss.org/jira/browse/JBSEAM-3652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Denis Forveille updated JBSEAM-3652:
------------------------------------

    Attachment: Test3652.java
                Test3652Conv.java
                testJBSEAM3652.xhtml


Shane, I created a simple test case that shows the problem and I think I hit another bug, ie that the method annotated with "@Create" may be called many times for a page scope component even if it should not (I guess)
I uploaded the traces produced by 4 tests cases:

For the 4 cases, I clicked 6 times quickly  on the link. The results:

Case 1 : We have a call in the ".xhtml" file that triggers the creation of the component before the user can click on the link and we don't use long running conversation
-> This illustrates the bug mentionned before in BijectionInterceptor. The component in conversation scope is shared between calls until BijectionInterceptore disinject it as described in my initial post (ie becomes null for one of the thread), then another instance of this component is automaticaly created. 
-> Calls to the "testMethod" method are not serialized as confirmed by the post of Dan
-> Q: Besides the NPE, should'nt  we have 6 different instances of the conversation scoped component there as we are not in a long running conversation??

Case 2:  The component is created when the user clics on the link and we don't use long running conversation
-> @Create is called 6 times (!!!!), creating 6 different instances of the conversation scope component. Wow !!!
-> Calls to the "testMethod" method are not serialized as confirmed by the post of Dan

Case 3:  We have a call in the .xhtml that triggers the creation of the component and we have a long running conversation started on @Create
-> Works as expected, I guess: @Create si called only once, and calls to the "testMethod" method are serialized

Case 4:  The component is created when the user clics on the link and and we have a long running conversation started on @Create
-> Quite similar to test case 2
-> @Create is called 6 times (!!!!), creating 6 different instances of the conversation scope component. Wow !!!
-> Calls to the "testMethod" method are not serialized, because I think the @Create methiod created 6 instances of the conversation scope component

To summarise:
1) this shows clearly the bug in BijectioNinterceptor (case 1)
2) there is another bug where @Create can be called many time for the same page scope component
3) IMHO, page scope component should almost always be annotated with @Synchronized to solve some forms of "double clics".

> Major reentrancy problem with "Page Scope" components and injection/disinjection
> --------------------------------------------------------------------------------
>
>                 Key: JBSEAM-3652
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3652
>             Project: Seam
>          Issue Type: Bug
>    Affects Versions: 2.0.2.SP1, 2.0.3.CR1, 2.1.0.GA
>         Environment: WebSphere v6.1.0.17 in POJO Mode 
>            Reporter: Denis Forveille
>            Assignee: Shane Bryzak
>            Priority: Blocker
>             Fix For: 2.1.1.CR1
>
>         Attachments: Test3652.java, Test3652Conv.java, testJBSEAM3652.xhtml, traces.txt
>
>
> This bug is very similar to the JBSEAM-3295 bug, but for "Page Scope" components this time
> Under stress, we have random NPE, "conversation expired" and other strange eroors from time to time in production
> This is due to a flaw in the "BijectionInterceptor" class and it is quite easy to reproduce
> On a facelets page, we have a datatable with a list of h:commadLink, teh first page of a classic "list entities/showDetail" scheme. The controleur that manages the list is in "Page Scope"
> When the user clics on one of the link, then quickly clic on another link, another one etc...  without waiting for the detail view to show up, we have two concurrent request addressed to the same Page Scope component (Verified by putting traces in the BijectionInterceptor class)
> In BijectionInterceptor, in that case, counter == 2 after line 77  meaning there is two concurrent thread running: the current thread + another one currently "using" the component
> The counter will be decrease for the first time on line 82,  then a second time on line 129 and so, disinjection will occur on line 134. This occurs while there is another thread "using" the component, causing random NPE and other errors!!!!
> In fact this will happen each time counter >1, ie there is more than one "concurrent" request on the same component
> This alleviate some questions:- 
> - is this normal that 2 (or more) concurrent request from the same user/conversation/page acces the same page scope component concurrently (I thought seam was taking care of this and was serializing such requests...
> - is this normal that on line 88, components are outjected, only when the last concurrent "user" of the component exits the interceptor and not when each request "eixts" the interceptor?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list