There's a race condition in AbstractConversationContext when create first conversation scope if it's the first request of one session.
Suppose such scenario
- User requests a jsf page
- weld creates a conversations map in the
AbstractConversationContext.associate()
- Because it is the first request, there's no session. Weld keep this
map in request
- A conversation scoped bean is created and put to the map.
- In somewhere, a session is created
- In the render phase, server sends partial response back. The page
need some jsf resource, eg, jsf2 ajax or jsf resource
- Browser requests the new jsf resource
- At this time The first request has not finished. So it doesn't reach
dissociate() and doesn't put conversations map in the session.
- Meanwhile The second request reach associate(). There's no
conversations map in the session, and the session is existing. It
puts its new map! <====
- 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()
Please see :
https://issues.jboss.org/browse/WELD-1418
WELD-1500 issue