You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Jetty keeps Sessions in use after "Duplicate valid session cookies" Message #6085
Description
After getting org.eclipse.jetty.http.BadMessageException: 400: Duplicate valid session cookies jetty keeps the duplicate sessions in use state (request counter in session >0). Thats why these session will not be invalidated by the HouseKeeper-Thread.
Is this a bug in jetty?
@ssoec4u I will put in a fix for this to ensure that duplicate valid sessions have their request counts decremented correctly.
But how the heck did you manage to get multiple sessions with different ids created, and moreover get the client to send more than 1 JSESSIONID cookie?
Also, you're more than 10 releases of jetty behind, it would be best if you could upgrade.
@ssoec4u I will put in a fix for this to ensure that duplicate valid sessions have their request counts decremented correctly.
But how the heck did you manage to get multiple sessions with different ids created, and moreover get the client to send more than 1 JSESSIONID cookie?
Also, you're more than 10 releases of jetty behind, it would be best if you could upgrade.
The problem can be understood if you call up a web link from an Excel (Microsoft) in a Window 10 with the current IE Edge. The condition is that the website uses session cookies for this.
If you then call up the link at least twice, the message appears in the log file.
I'm running into this same issue with Jetty 12.1.11.
I'm running Jetty embedded via a language runtime's HTTP server library (Kap's httpserver2), which is not a typical WAR deployment. The server starts via a script (kap main.kap) that I've been killing and restarting very frequently during iterative development (probably 20-30 times over the course of an extended debugging session), each restart spinning up a brand-new process with a completely fresh in-memory session table.
Throughout that whole session I kept the same browser tab open against http://localhost:8080, logging in, testing, restarting the server, and logging in again — without ever manually clearing cookies between restarts. So the sequence was something like: log in (session A created, cookie set) → kill server → restart server (fresh session store, no memory of session A) → log in again in the same tab (session B created) → repeat several more times.
Eventually a request came in that got rejected with:
So it looks like the browser ended up holding onto more than one cookie for the session cookie name/path at once, presumably accumulated across some subset of those restarts, and eventually sent more than one in a single request.
My app touches the session from two different URL path prefixes in a row during a single login: first at POST /dologin (root-level path), then immediately after (via redirect) at GET /admin/posts (nested under /admin). My cookie jar shows exactly two JSESSIONID cookies, one scoped Path=/ and one scoped Path=/admin — which lines up precisely with those two touch points. So it looks like session cookies are being scoped to wherever the session was first accessed from, rather than defaulting to the application root — and when a later request under a different prefix doesn't carry the first cookie back (or isn't recognized as the same session), a second session gets created, and now two valid ones collide. Does that match what you'd expect from the code path this hits?
Activity
janbartel commentedon Mar 23, 2021
@ssoec4u I will put in a fix for this to ensure that duplicate valid sessions have their request counts decremented correctly.
But how the heck did you manage to get multiple sessions with different ids created, and moreover get the client to send more than 1 JSESSIONID cookie?
Also, you're more than 10 releases of jetty behind, it would be best if you could upgrade.
Issue #6085 Fix reference counts for multiple valid cookies for sesss…
Issue #6085 Fix reference counts for multiple valid cookies for sessi…
janbartel commentedon Mar 24, 2021
Fixed via #6088.
Issue #6085 Fix reference counts for multiple valid cookies for sessi…
Issue #6085 Fix reference counts for multiple valid cookies for sessi…
ssoec4u commentedon Mar 25, 2021
The problem can be understood if you call up a web link from an Excel (Microsoft) in a Window 10 with the current IE Edge. The condition is that the website uses session cookies for this.
If you then call up the link at least twice, the message appears in the log file.
Issue #6085 Fix duplicate valid session cookies to pick first valid.
Issue #6085 Fix duplicate valid session cookies to pick first valid.
Issue #6085 Fix duplicate valid session cookies to pick first valid.
Issue #6085 Fix duplicate valid session cookies to pick first valid.
Issue #6085 Fix duplicate valid session cookies to pick first valid.
Issue #6085 Fix duplicate valid session cookies to pick first valid.
Issue #6085 Fix duplicate valid session cookies to pick first valid.
Issue #6085 Fix duplicate valid session cookies to pick first valid.
Issue #6085 Fix duplicate valid session cookies to pick first valid.
Issue #6085 Fix duplicate valid session cookies to pick first valid.
kapitaali commentedon Aug 8, 2026
I'm running into this same issue with Jetty 12.1.11.
I'm running Jetty embedded via a language runtime's HTTP server library (Kap's
httpserver2), which is not a typical WAR deployment. The server starts via a script (kap main.kap) that I've been killing and restarting very frequently during iterative development (probably 20-30 times over the course of an extended debugging session), each restart spinning up a brand-new process with a completely fresh in-memory session table.Throughout that whole session I kept the same browser tab open against
http://localhost:8080, logging in, testing, restarting the server, and logging in again — without ever manually clearing cookies between restarts. So the sequence was something like: log in (session A created, cookie set) → kill server → restart server (fresh session store, no memory of session A) → log in again in the same tab (session B created) → repeat several more times.Eventually a request came in that got rejected with:
So it looks like the browser ended up holding onto more than one cookie for the session cookie name/path at once, presumably accumulated across some subset of those restarts, and eventually sent more than one in a single request.
My app touches the session from two different URL path prefixes in a row during a single login: first at POST /dologin (root-level path), then immediately after (via redirect) at GET /admin/posts (nested under /admin). My cookie jar shows exactly two JSESSIONID cookies, one scoped Path=/ and one scoped Path=/admin — which lines up precisely with those two touch points. So it looks like session cookies are being scoped to wherever the session was first accessed from, rather than defaulting to the application root — and when a later request under a different prefix doesn't carry the first cookie back (or isn't recognized as the same session), a second session gets created, and now two valid ones collide. Does that match what you'd expect from the code path this hits?