Announcement Announcement Module
No announcement yet.
Race condition in web flow when reading parameter from request Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Race condition in web flow when reading parameter from request

    Under heavy workload, some users are seeing other users' data. In particular, we have a problem while running the next snippets:

    Flow XML:
    <action-state id="checkOptout">
    <evaluate expression="loginService.checkOptout(requestParameters.UserName, flowRequestContext)"/>
        <transition on="1" to="redirect"/>
        <transition on="2" to="validate"/>
    Method implementation invoked from flow:
    public String checkOptout(String profile, RequestContext context) throws Exception {
    try {
        final ServletExternalContext externalContext = (ServletExternalContext) context.getExternalContext();
        final HttpServletRequest request = (HttpServletRequest) externalContext.getNativeRequest();
        final String userName = request.getParameter("UserName");
        if (!userName.equals(profile)) { 
    As you can see above, the flow is passing in a parameter coming from the request to the invoked method. Once inside the method, we read again the same parameter also coming from request and compare them. Under high workload, they are sometimes different. We've been able to find out the right value is always the one read from the request inside the method. This clearly evidences there is a concurrency problem in the expression evaluation within the flow.

    In addition, we are getting several crossover exceptions in WebSphere 7.0 that suggests something is wrong.

    We have currently Spring 3.1.4 + Spring Web Flow 2.2.0. After upgrading SWF to 2.3.1 and later to 2.3.2, the problem still persists.

    - Is there any solution for this in the short term?
    - Is there any workaround we can apply?
    - Is there any change to have something misconfigured?

    Any help would be really appreciated.

    Best regards.

    N.B: We have open a new JIRA as we think there is a bug in the framework code.

  • #2
    Hi guys,

    Good news, we have found the root cause. When we upgraded to SWF 2.3.1, we didn't do it in all our modules, doing the upgrade ineffective. Now hat we have upgraded to SWF 2.3.1 all our modules, the problem has vanished and everything works good.

    Best regards.