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 data race when context cancelled during connect
The application-supplied BuildContextWatcherHandler was armed during the
auth handshake. If the context was cancelled mid-connect, handlers that
read *PgConn fields (notably CancelRequestContextWatcherHandler, which
reads pgConn.pid and pgConn.secretKey via CancelRequest) would race with
the connect goroutine's writes to those fields when handling
BackendKeyData. CancelRequest semantics also don't make sense before the
connection is established.
Use the deadline-only handler during connect and swap in the
application-supplied handler at ReadyForQuery, before any queries
ValidateConnect might run.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments