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 deadlock when pipelining statements.#773

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
sfackler merged 3 commits intorust-postgres:masterfromerikjohnston:avoid_deadlock
May 19, 2021

Conversation

erikjohnston
Copy link
Contributor

Fixes#772.

The first commit implements the suggestion from the issue to not overwrite any existing cached statements, which should be enough to fix the bug. The second commit splits the cached type info and the byte buffer to have separate locks, to try and reduce the risk of similar bugs happening again.

I've also tried to document a few things which I spent some time puzzling out, though they may only make sense to me so I'm happy to back them out.

When executing statements in parallel there is a race where we preparethe type info queries multiple times, and so insert into the type infocaches multiple times. This resulted in any existing cached `Statement`to be dropped, running its destructor which attempts to take out thestate lock that is already being held, resulting in a deadlock.Fixesrust-postgres#772.
There is no reason for the buffer and typeinfo caches to share the samelock. By splitting them it means we a) get slightly better performance,but more importantly b) it makes it harder to accidentally deadlock.
@sfacklersfackler merged commit1986cb1 intorust-postgres:masterMay 19, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@sfacklersfacklerAwaiting requested review from sfackler

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

tokio-postgres occasionally hangs when pipe lining in a transaction

2 participants

@erikjohnston@sfackler

[8]ページ先頭

©2009-2025 Movatter.jp