[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-3295) Major reentrancy problem with "Application Scope" components and injection/disinjection
Pete Muir (JIRA)
jira-events at lists.jboss.org
Fri Aug 22 18:22:38 EDT 2008
[ https://jira.jboss.org/jira/browse/JBSEAM-3295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12426301#action_12426301 ]
Pete Muir commented on JBSEAM-3295:
-----------------------------------
Yeah, I was just being lazy on a Friday night ;-)
I did the backport (n.b. it was my fix ;-)
I also targeted JBSEAM-3301 at 2.0.3 as well...
> Major reentrancy problem with "Application Scope" components and injection/disinjection
> ---------------------------------------------------------------------------------------
>
> Key: JBSEAM-3295
> URL: https://jira.jboss.org/jira/browse/JBSEAM-3295
> Project: Seam
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.2.SP1
> Environment: WebSphere v6.1.0.17 in POJO Mode
> Reporter: Denis Forveille
> Assignee: Pete Muir
> Priority: Blocker
> Fix For: 2.0.3.CR2, 2.1.0.BETA1
>
> Attachments: BijectionInterceptor_Denis.java
>
>
> There is a major reentrancy problem with "Application Scope" components and injection/disinjection
> As in any component @In dependent object are injected/disinjected with the BijectionInterceptor interceptor
> As there is one instance of BijectionInterceptor per Component (It seems), there is only one instance of BijectionInterceptor in the JVM for an Application Scope Component, instance shared by all threads
> With that in mind, take:
> - 2 running thread (T1, T2)
> - One application scope component (C1) with many at In attributes (All referecing Application Scope components too..)
> T1 enters method M1 of C1. BijectionInterceptor inject @In depedencies of C1, and set the "reentrant" attribute of the instance of BijectionInterceptor attached to C1 to "true"
> T2 enters method M1of C1. BijectionInterceptor does nothing as "reentrant" is true
> T1 exits method M1 of C1. As this is thios thread (T1) that set "reentrant" initially, it performs the "disinjection" and set all the @In attribues of C1 to null
> T2 then fails with NPE as all the @In attributes of C1 are set to null !!!!!
> Core of the org.jboss.seam.core.BijectionInterceptor class:
> private boolean reentrant; //OK, since all Seam components are single-threaded
> @AroundInvoke
> public Object aroundInvoke(InvocationContext invocation) throws Exception{
> if (reentrant) {
> return invocation.proceed();
> }
> else {
> reentrant = true;
> try {
> Component component = getComponent();
> boolean enforceRequired = !component.isLifecycleMethod( invocation.getMethod() );
> component.inject( invocation.getTarget(), enforceRequired );
> Object result = invocation.proceed();
> component.outject( invocation.getTarget(), enforceRequired );
> component.disinject( invocation.getTarget() );
> return result;
> }
> finally {
> reentrant = false;
> }
> }
> }
--
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