Local session state: Users get logged out every few clicks after we added a second server
Local session state debugging lab. After adding a second web server for Black Friday, users are bounced back to the login page every couple of clicks. With one server it never happens.
Practice debugging a local session state in a live, broken production system in your browser, with Redis. Find the root cause in the logs, terminal and code, fix it, and a load test checks that the fix holds under real traffic.
1. The Incident Context
Ahead of Black Friday, ops added two more web servers behind the load balancer. Since then, users keep getting bounced to the login page every two or three clicks. With a single server this never happened. There are no crashes and no errors other than 401 session not found on GET /me.
2. Observed Symptoms & Metrics
- Affected Endpoints / Components:
POST /login, GET /me, the session cookie, three app replicas behind a round-robin proxy.
- Behavior: A user logs in, and the next click usually works. The click after that sends them to login again, then they're in again, then out. Roughly two of every three clicks lose the session.
- Error Rate: About 66% of
GET /me requests return 401, even with a valid-looking session cookie.
- System Metrics: All three replicas are healthy. Redis holds no keys. No memory or CPU pressure.
3. Application Logs
14:02:11 shop listening on :18081 (replica 1)
14:02:12 shop listening on :18082 (replica 2)
14:02:13 shop listening on :18083 (replica 3)
14:03:40 GET /me 401: session not found
14:03:41 GET /me 401: session not found
14:03:42 GET /me 200
14:03:43 GET /me 401: session not found
4. Your Objective
Step into the live environment while synthetic traffic is running, diagnose the root cause, and patch the codebase.
To clear this stack, your fix must satisfy these automated verification checks under a 60-second load test:
- No unexpected logouts: every
GET /me after a successful login is recognized (checks_fails == 0).
- Performance: P99 latency stays below 200 ms.
Toolbox: curl -c jar -b jar localhost:8080/me, redis-cli keys 'sess:*', redis-cli monitor, the app logs.
Save a file in the editor to rebuild and restart the app. Click Verify when you think it's fixed.
Your account and data
You can browse stacks without an account. To run labs you sign in with your email or Google account. BustedStack uses your email address to
sign you in, and your name and profile picture to show your account and pre-fill certificates. We never access your Gmail, contacts or Drive,
sell your data or run ad trackers.
Privacy Policy · Terms of Service · Browse stacks ·
hello@bustedstack.com
This site needs JavaScript to run labs.