-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix race condition when trie generation thread may be invoked after storage has been closed #3505
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@swift-ci please smoke test |
yim-lee
approved these changes
May 19, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks @tomerd. I verified locally that with this patch I no longer see the error:
PackageCollections/SQLitePackageCollectionsStorage.swift:74: Fatal error: db should be closed
in tests.
…torage has been closed motivation: with trie genration now running on lower priority, a race was exposed where the operation may start after the storage already was closed changes: * in trie generation, guard on state before trying to execute a statement on the connection since it may be terminated * in SQLite storage assert state does not got back frmo disconnected -> connected to help triage such issues * adjust test to new assertion
191c3ee
to
5b2b7d6
Compare
@swift-ci please smoke test |
tomerd
added a commit
to tomerd/swift-package-manager
that referenced
this pull request
May 19, 2021
…torage has been closed (swiftlang#3505) motivation: with trie genration now running on lower priority, a race was exposed where the operation may start after the storage already was closed changes: * in trie generation, guard on state before trying to execute a statement on the connection since it may be terminated * in SQLite storage assert state does not got back frmo disconnected -> connected to help triage such issues * adjust test to new assertion
yim-lee
added a commit
to yim-lee/swift-package-manager
that referenced
this pull request
May 26, 2021
…e closed Motivation: With swiftlang#3505, the code does `preconditionFailure` when trying to execute DB statement after connection is disconnected. In `populateTargetTrie` we check connection state before calling `executeStatement`, but it's still possible for storage to close _after_ the check but _before_ `executeStatement`. This might have caused rdar://78513692. Modifications: - Throw error instead of `preconditionFailure` - Unrelated: `GitHubPackageMetadataProvider.configuration` doesn't need to be var
yim-lee
added a commit
that referenced
this pull request
May 26, 2021
…e closed (#3512) Motivation: With #3505, the code does `preconditionFailure` when trying to execute DB statement after connection is disconnected. In `populateTargetTrie` we check connection state before calling `executeStatement`, but it's still possible for storage to close _after_ the check but _before_ `executeStatement`. This might have caused rdar://78513692. Modifications: - Throw error instead of `preconditionFailure` - Unrelated: `GitHubPackageMetadataProvider.configuration` doesn't need to be var
yim-lee
added a commit
to yim-lee/swift-package-manager
that referenced
this pull request
May 26, 2021
…e closed Motivation: With swiftlang#3505, the code does `preconditionFailure` when trying to execute DB statement after connection is disconnected. In `populateTargetTrie` we check connection state before calling `executeStatement`, but it's still possible for storage to close _after_ the check but _before_ `executeStatement`. This might have caused rdar://78513692. Modifications: - Throw error instead of `preconditionFailure` - Unrelated: `GitHubPackageMetadataProvider.configuration` doesn't need to be var
yim-lee
added a commit
that referenced
this pull request
May 27, 2021
…e closed (#3513) Motivation: With #3505, the code does `preconditionFailure` when trying to execute DB statement after connection is disconnected. In `populateTargetTrie` we check connection state before calling `executeStatement`, but it's still possible for storage to close _after_ the check but _before_ `executeStatement`. This might have caused rdar://78513692. Modifications: - Throw error instead of `preconditionFailure` - Unrelated: `GitHubPackageMetadataProvider.configuration` doesn't need to be var
bitjammer
pushed a commit
to bitjammer/swift-package-manager
that referenced
this pull request
Jul 23, 2021
…torage has been closed (swiftlang#3505) motivation: with trie genration now running on lower priority, a race was exposed where the operation may start after the storage already was closed changes: * in trie generation, guard on state before trying to execute a statement on the connection since it may be terminated * in SQLite storage assert state does not got back frmo disconnected -> connected to help triage such issues * adjust test to new assertion
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
motivation: with trie genration now running on lower priority, a race was exposed where the operation may start after the storage already was closed
changes: guard on state before trying to execute a statement on the connection since it may be terminated