Bug 999050

Summary: Scoped CDI interceptor cause Stackoverflow
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Aslak Knutsen <aknutsen>
Component: CDI/WeldAssignee: Jozef Hartinger <jharting>
Status: CLOSED CURRENTRELEASE QA Contact: Ron Šmeral <rsmeral>
Severity: medium Docs Contact: Russell Dickenson <rdickens>
Priority: unspecified    
Version: 6.1.0CC: amelicha, jharting, pmuir
Target Milestone: ER3   
Target Release: EAP 6.2.0   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-15 16:16:58 UTC 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: 1003581    

Description Aslak Knutsen 2013-08-20 15:36:13 UTC
Description of problem:


Version-Release number of selected component (if applicable):
6.1.0.GA

How reproducible:
10%

Steps to Reproduce:
1. Create CDI Bean
2. Create a Interceptor Binding Annotation
3. Add Interceptor Binding to CDI Bean
4. Create a Interceptor
5. Run code, all OK
6. Add _any_ non Dependent scope to the Interceptor @Request|Session|ApplicationScope
7. Run code, Stackoverflow

Actual results:

org.jboss.weld.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:69)
16:22:29,943 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-2)       at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:112)
16:22:29,943 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-2)       at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:88)
16:22:29,943 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-2)       at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:55)
16:22:29,943 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-2)       at org.cedj.geekseek.web.rest.core.test.integration.TestResource$Proxy$_$$_WeldSubclass.get(TestResource$Proxy$_$$_WeldSubclass.java)
16:22:29,943 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-2)       at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
16:22:29,943 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-2)       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
16:22:29,943 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-2)       at java.lang.reflect.Method.invoke(Method.java:606)
16:22:29,943 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-2)       at org.jboss.weld.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:85)
16:22:29,943 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-2)       at org.jboss.weld.interceptor.proxy.InterceptorInvocationContext.proceed(InterceptorInvocationContext.java:127)
16:22:29,943 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-2)       at org.cedj.geekseek.web.rest.core.interceptor.RESTInterceptorEnabler.intercept(RESTInterceptorEnabler.java:44)
16:22:29,943 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-2)       at org.cedj.geekseek.web.rest.core.interceptor.RESTInterceptorEnabler$Proxy$_$$_WeldClientProxy.intercept(RESTInterceptorEnabler$Proxy$_$$_WeldClientProxy.java)
16:22:29,943 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-2)       at sun.reflect.GeneratedMethodAccessor87.invoke(Unknown Source)
16:22:29,944 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-2)       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
16:22:29,944 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-2)       at java.lang.reflect.Method.invoke(Method.java:606)
16:22:29,944 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-2)       at org.jboss.weld.interceptor.proxy.SimpleMethodInvocation.invoke(SimpleMethodInvocation.java:30)
16:22:29,944 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-2)       at org.jboss.weld.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:69)

Expected results:

Pr CDI spec:
"An interceptor instance is a dependent object of the object it intercepts"

So, Scoped Interceptors is defined as non-portable behavior. 

Deployment Validation Exception would help, since Weld can't handle it.

Additional info:

Arquillian based test case to demonstrate the problem:
https://github.com/aslakknutsen/cdi-eap-interceptor-stackoverflow

Comment 1 JBoss JIRA Server 2013-08-27 11:32:54 UTC
Marko Lukša <marko.luksa> made a comment on jira WELD-1483

Pull request at https://github.com/weld/core/pull/351

Comment 3 JBoss JIRA Server 2013-08-29 06:59:54 UTC
Jozef Hartinger <jharting> made a comment on jira WELD-1483

Merged, please also create a PR for the master branch.

Comment 7 Paul Gier 2013-12-04 14:19:56 UTC
Looks like this fix was included in EAP 6.2 via Weld 1.1.15.Final.  Setting to ON_QA.

Comment 8 Ron Šmeral 2013-12-06 15:41:55 UTC
Verified on EAP 6.2.0.CR3 (EAP_6.2.0.CR3-dev2).