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
Fix UNIQUE constraint race in session submit with atomic upsert
The check-then-insert pattern in SessionStore.submit() had a TOCTOU
race: two concurrent submissions of the same session (e.g. local
client + remote client) could both pass the existence check, then
one INSERT would succeed and the other would crash with
IntegrityError, returning 500 to the client.
Replace with INSERT ... ON CONFLICT DO UPDATE (upsert). The WHERE
clause ensures we only update when the content actually changed,
so duplicate submissions with identical content are still skipped.
0 commit comments