On 14 November 2012 19:04, Mark Rathwell <
mark.r...@gmail.com> wrote:
> Could you expand on what you mean when you say different threads are
> accessing the session? Do you mean separate requests (with the same session
> cookie)? Or do you have some background thread trying to modify the session
> store? Can't quite picture what you are describing.
I have one client, with one session cookie. Jetty spawns multiple
threads to handle the incoming requests, there are no other threads
involved. I used log4j to log debug messages with the thread id, which
makes me think the second jetty thread is seeing an old version of the
session data. The code looks like:
(debug "Work list (before)" (session/get :work-list))
(session/swap! remove-variant-from-work-list params)
(debug "Work list (after)" (session/get :work-list))
This produces the expected log lines:
2012-11-12 15:09:28,711 [1073027@qtp-15335895-5] DEBUG Work list
(before) ({:pos 33411111, :chr 6} {:pos 34542876, :chr 15} {:pos
241724480, :chr 2})
2012-11-12 15:09:28,711 [1073027@qtp-15335895-5] DEBUG Work list
(after) ({:pos 34542876, :chr 15} {:pos 241724480, :chr 2})
At this point, HTML is delivered to the browser, I review the form and
post it back to the server. It happens that the post is handled by a
different Jetty thread (about 30 seconds after the first request):
2012-11-12 15:10:08,780 [14979322@qtp-15335895-3] DEBUG Work list
(before) ({:pos 33411111, :chr 6} {:pos 34542876, :chr 15} {:pos
241724480, :chr 2})
2012-11-12 15:10:08,781 [14979322@qtp-15335895-3] DEBUG Work list
(after) ({:pos 34542876, :chr 15} {:pos 241724480, :chr 2})
As you see, the work list retrieved from the session by this thread
has the original 3 items, not the 2 I expect.