Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deadlock on sqlite with PrepareStmt = true #783

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pascal-fischer
Copy link

Requirements:

  • using sqlite
  • setting sqlDB.SetMaxOpenConns to 1
  • setting PrepareStmt to true

There seems to be a race condition if we have 2 goroutines try to call the same db read at the same time (for the test I have multiple goroutines so the test is more likely to hit the race condition):

  • one call is in a transaction the other one is not -> FAIL
  • both calls in a transaction -> SUCCESS
  • both calls outside of transaction -> SUCCESS

If we set PrepareStmt to false it will work as expected

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