[jboss-jira] [JBoss JIRA] (WFLY-5716) Wrong handling of request context for remote EJB calls

Ste Gr (JIRA) issues at jboss.org
Mon Nov 23 04:47:00 EST 2015


    [ https://issues.jboss.org/browse/WFLY-5716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13132492#comment-13132492 ] 

Ste Gr edited comment on WFLY-5716 at 11/23/15 4:46 AM:
--------------------------------------------------------

I've attached sources and pre-build jar files.

Please deploy them and open the URLs and click on the displayed button.
* http://server:8080/wfly5716-fw/index.jsf
* http://server:8080/wfly5716-app/index.jsf

You will see some outputs in the log. I've attached the output that I'm getting. As you can see the lines for "INIT" and "DESTROY" are at different locations. For _wfly5716-fw_ it seems to be correct as both "DUMMY" calls are made while the request scoped bean is valid. For _wfly5716-app_ this is not the case. The second "DUMMY" call is made after the bean has bean invalidated and no new one is created for the second call.

*wfly5716-fw*
{code}
10:42:41,590 INFO  [stdout] (default task-9) [fw] IFrameworkResourceManager = Proxy for remote EJB StatelessEJBLocator for "/wfly5716-fw/WebFrameworkImpl", view is interface testing.wfly5716.share.IWebFramework, affinity is None
10:42:41,592 INFO  [stdout] (default task-9) [fw] invoke WebFrameworkImpl#resolveUser
10:42:41,592 INFO  [stdout] (default task-9) [fw] testing.wfly5716.fw.RequestBean at 483c00d3 INIT
10:42:41,592 INFO  [stdout] (default task-9) [fw] testing.wfly5716.fw.RequestBean at 483c00d3 DUMMY
10:42:41,593 INFO  [stdout] (default task-9) [fw] invoke WebFrameworkImpl#resolveRights
10:42:41,593 INFO  [stdout] (default task-9) [fw] testing.wfly5716.fw.RequestBean at 483c00d3 DUMMY
10:42:41,597 INFO  [stdout] (default task-9) [fw] testing.wfly5716.fw.RequestBean at 483c00d3 DESTROY
{code}

*wfly5716-app*
{code}
10:44:07,966 INFO  [stdout] (default task-13) [app] IFrameworkResourceManager = Proxy for remote EJB StatelessEJBLocator for "/wfly5716-fw/WebFrameworkImpl", view is interface testing.wfly5716.share.IWebFramework, affinity is None
10:44:07,967 INFO  [stdout] (default task-13) [fw] invoke WebFrameworkImpl#resolveUser
10:44:07,968 INFO  [stdout] (default task-13) [fw] testing.wfly5716.fw.RequestBean at 49356a INIT
10:44:07,968 INFO  [stdout] (default task-13) [fw] testing.wfly5716.fw.RequestBean at 49356a DUMMY
10:44:07,968 INFO  [stdout] (default task-13) [fw] testing.wfly5716.fw.RequestBean at 49356a DESTROY
10:44:07,969 INFO  [stdout] (default task-13) [fw] invoke WebFrameworkImpl#resolveRights
10:44:07,969 INFO  [stdout] (default task-13) [fw] testing.wfly5716.fw.RequestBean at 49356a DUMMY
{code}


was (Author: grubi):
sources and pre-build jar/war files.

> Wrong handling of request context for remote EJB calls
> ------------------------------------------------------
>
>                 Key: WFLY-5716
>                 URL: https://issues.jboss.org/browse/WFLY-5716
>             Project: WildFly
>          Issue Type: Bug
>          Components: CDI / Weld, EJB
>    Affects Versions: 9.0.0.Final, 10.0.0.CR4
>            Reporter: Ste Gr
>            Assignee: Stuart Douglas
>         Attachments: wfly5716.zip
>
>
> Two applications deployed to Wildfly. The first one provides a singleton remote ejb which uses request scoped beans (in this case a RESOURCE_LOCAL entity manager manged by a CDI producer/disposer, but +all+ request scoped beans are affected). The second application uses that EJB to get some data only accessible by the first application.
> A request is made to the second app from a browser. The app will get the remote EJB and invokes two methods on it. The first method produces the entity manager, accesses the database and returns the result. The entity manager will be disposed again. The second method won't produce a new entity manager but tries to re-use the one from the previous invokation. This fails as the entity manager was disposed.
> If the same use-case is made using the first app everythings works as desired. But it doesn't look right (or the request context is joined because it is the same application). It produces the the entity manager on the first invocation and closes it as soon as the whole request made from the browser is completed. Thats why the second invokation has a valid entity manager to work with.
> I don't know the spec but:
>  - either the first EJB invokation from second app to first app is not allowed to dispose the request context (all the request scoped beans)
>  - or each invokation must get its own request context (entity manager must be produced and disposed again).
> I've made a [stackoverflow thread|http://stackoverflow.com/q/33826720/1741604] which shows some code examples.
> (JBoss AS 7.1.3.Final is also affected but it is not available in 'affected version/s')



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list