Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1418

NonexistentConversationException: WELD-000321 No conversation found to restore for id 1

    Details

    • Steps to Reproduce:
      Hide

      Package and deploy the example application to tomcat
      clear browser cache
      open the fist page http://localhost:8080/weldissuetomcat/issue.jsf
      click the link at the first line
      You have a big chance (>50%) to see the exception
      If not reproduced, close the browser and clear cache to try again.

      Show
      Package and deploy the example application to tomcat clear browser cache open the fist page http://localhost:8080/weldissuetomcat/issue.jsf click the link at the first line You have a big chance (>50%) to see the exception If not reproduced, close the browser and clear cache to try again.

      Description

      There's a race condition in AbstractConversationContext when create first conversation scope if it's the first request of one session.
      Suppose such scenario

      1. User requests a jsf page
      2. weld creates a conversations map in the AbstractConversationContext.associate()
      3. Because it is the first request, there's no session. Weld keep this map in request
      4. A conversation scoped bean is created and put to the map.
      5. In somewhere, a session is created
      6. In the render phase, server sends partial response back. The page need some jsf resource, eg, jsf2 ajax or jsf resource
      7. Browser requests the new jsf resource
      8. At this time The first request has not finished. So it doesn't reach dissociate() and doesn't put conversations map in the session.
      9. Meanwhile The second request reach associate(). There's no conversations map in the session, and the session is existing. It puts its new map! <====
      10. Then, even the first request reach dissociate(), because there's already a map, it doesn't put its owner anymore. <====

      A quick and dirty fix is always create session before associate(). However, it's better to merge the map in the dissociate()

      I upload a example which is very easy to reproduce the problem.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                luksa Marko Luksa
                Reporter:
                pikachu yi gong
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: