Bug 1215570 - (6.2.0) Injected Context becomes invalid after Service Reference is invoked
Summary: (6.2.0) Injected Context becomes invalid after Service Reference is invoked
Keywords:
Status: ON_QA
Alias: None
Product: JBoss Fuse Service Works 6
Classification: JBoss
Component: SwitchYard
Version: 6.0.0 GA
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: CR1
: ---
Assignee: tcunning
QA Contact: Matej Melko
URL:
Whiteboard:
Depends On:
Blocks: 1215572
TreeView+ depends on / blocked
 
Reported: 2015-04-27 07:23 UTC by Tadayoshi Sato
Modified: 2019-09-12 08:25 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1215572 (view as bug list)
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)
reproducer (6.98 KB, application/zip)
2015-04-27 07:23 UTC, Tadayoshi Sato
no flags Details
Reproducer for second use case. (29.63 KB, application/zip)
2015-07-23 18:21 UTC, Rick Wagner
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker SWITCHYARD-2674 0 Major Resolved Context/Message/Exchange injection is corrupted after another bean invocation 2016-04-05 15:16:18 UTC

Description Tadayoshi Sato 2015-04-27 07:23:34 UTC
Created attachment 1019253 [details]
reproducer

Description of problem:
Platform BZ for https://issues.jboss.org/browse/SWITCHYARD-2674

In a Bean service ('OuterService' below), after invoking a Bean service reference ('InnerService' below) the injected Context becomes invalid, throwing the following exception:

> java.lang.IllegalStateException: SWITCHYARD030422: Illegal call to get the SwitchYard Context; must be called within the execution of an ExchangeHandler chain.

@Service(value = OuterService.class)
public class OuterServiceBean implements OuterService {
    @Inject
    private Context context;

    @Inject @Reference
    private InnerService inner;

    @Override
    public int getNumber(String in) {
        // This succeeds
        context.setProperty("FIRST", 1, Scope.EXCHANGE);
        // Invoke the referenced service
        int val = inner.parseNumber(in);
        // This fails since it is after the reference invocation
        context.setProperty("SECOND", 2, Scope.EXCHANGE);
        return val;
    }
}


Version-Release number of selected component (if applicable):
n/a


How reproducible:
100%


Steps to Reproduce:
1. Run `mvn test` against the attached reproducer.

Actual results:
Test doesn't pass.

Expected results:
Test should pass.

Additional info:
n/a

Comment 1 Rick Wagner 2015-07-23 18:21:36 UTC
Created attachment 1055475 [details]
Reproducer for second use case.

The second reproducer demonstrates Exchange corruption after a Bean Component invokes a Reference, then another Reference is invoked after that.  (It doesn't seem to matter if the two downstream components are invoked 'in parallel' or 'in series', there is a failure.)

To see the problem, install the application then use curl to post a request:
curl -v -H "Content-Type: text/plain" -X POST --data "@someData.txt" http://localhost:8080/example/acceptXML

# someData.txt
<xml>some data</xml>


Note You need to log in before you can comment on or make changes to this bug.