Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(cli): fix flakes related to context cancellation when establishing pg connections#18246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
hugodutka merged 1 commit intomainfromhugodutka/pg-cancellation-flakes
Jun 5, 2025

Conversation

hugodutka
Copy link
Contributor

@hugodutkahugodutka commentedJun 5, 2025
edited
Loading

Since#18195 was merged, we started running CLI tests with postgres instead of just dbmem. This surfaced errors related to context cancellation while establishing postgres connections.

This PR shouldfixcoder/internal#672. Related to#15109.

@hugodutkahugodutka requested a review fromjohnstcnJune 5, 2025 13:03
@hugodutkahugodutka changed the titlefix(cli): flakes related to context cancellation while establishing pg connectionsfix(cli): fix flakes related to context cancellation when establishing pg connectionsJun 5, 2025
Comment on lines 172 to 176
// When a test exits it cancels the context. If a transaction is open
// and a query is being executed, instead of a context.Canceled error
// we get a "driver: bad connection" error.
return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Wouldn't exiting with an open transaction be bugged behaviour? Could this mask someone forgetting to close a connection?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hmm, I should probably make the comment clearer. It should be

When we cancel the context on a query that's being executed within a transaction, sometimes, instead of a context.Canceled error we get a "driver: bad connection" error.

I don't think this could mask someone forgetting to close a connection. I suppose it might mask someone closing a connection while a transaction is being executed? I'm not sure how the database would handle this scenario.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

seems to also be reported here:lib/pq#1137

@hugodutkahugodutkaforce-pushed thehugodutka/pg-cancellation-flakes branch fromcf0daf4 to3864e86CompareJune 5, 2025 13:36
@hugodutkahugodutka merged commit623dcd9 intomainJun 5, 2025
36 checks passed
@hugodutkahugodutka deleted the hugodutka/pg-cancellation-flakes branchJune 5, 2025 13:54
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJun 5, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

Assignees

@hugodutkahugodutka

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

flake: TestServer/Logging fails withno rows returned for version select
2 participants
@hugodutka@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp