Skip to content

Avoid calling response writers while holding the Jaws lock#184

Merged
linkdata merged 2 commits into
mainfrom
fix/172-newsession-responsewriter-lock
Jul 20, 2026
Merged

Avoid calling response writers while holding the Jaws lock#184
linkdata merged 2 commits into
mainfrom
fix/172-newsession-responsewriter-lock

Conversation

@linkdata

Copy link
Copy Markdown
Owner

Summary

  • keep session ID allocation and registration atomic under jw.mu
  • copy the session cookie, then release the lock before calling http.SetCookie or updating the request
  • add a regression test with a ResponseWriter that re-enters Jaws through Header, while also verifying registration and cookie propagation

Closes #172.

Verification

  • go test -race -run '^TestSession_NewSessionCallsResponseWriterOutsideLock$' .
  • go test -race -count=1 ./...
  • go vet ./...
  • staticcheck ./...
  • gofmt
  • git diff --check

@linkdata
linkdata merged commit 9693190 into main Jul 20, 2026
7 checks passed
@linkdata
linkdata deleted the fix/172-newsession-responsewriter-lock branch July 20, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NewSession can deadlock while setting a cookie under jw.mu

1 participant