Skip to content

Fix connection hang when a transaction ends during COPY - #1453

Open
atzoum wants to merge 1 commit into
lib:mainfrom
rudderlabs:fix/copy-hang-master
Open

atzoum wants to merge 1 commit into
lib:mainfrom
rudderlabs:fix/copy-hang-master

Conversation

@atzoum

@atzoum atzoum commented Nov 5, 2026

Copy link
Copy Markdown

While a COPY is open, resploop is the only goroutine allowed to read from the connection. Commit and Rollback can run while it is still reading, e.g. when database/sql rolls back on context cancellation, leaving two goroutines reading the same stream. One of them then waits forever for a reply the other consumed.

End any open COPY with CopyFail and wait for resploop to finish before sending COMMIT or ROLLBACK.

See #1452

While a COPY is open, resploop is the only goroutine allowed to read from
the connection. Commit and Rollback can run while it is still reading,
e.g. when database/sql rolls back on context cancellation, leaving two
goroutines reading the same stream. One of them then waits forever for a
reply the other consumed.

End any open COPY with CopyFail and wait for resploop to finish before
sending COMMIT or ROLLBACK.

See lib#1452

🔒 Scanned for secrets using gitleaks 8.30.1
@atzoum
atzoum force-pushed the fix/copy-hang-master branch from 87fb01a to 755cd2e Compare November 6, 2026 10:08
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.

1 participant