Skip to content

Fix race in index delegate callback #110

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
merged 2 commits into from
Sep 1, 2020

Conversation

benlangmuir
Copy link
Contributor

All calls to processingCompleted are called from the unit processing queue, but processingAddedPending can be called from other queues, including an arbitrary queue in the case of addUnitOutFilePaths and removeUnitOutFilePaths.

The result is that if there is a session being processed, we might increment and decrement PendingActions concurrently. We obsevered an assertion failure where NumActions was greater than NumActions, which was likely caused by this race.

rdar://68024910


Also, switch to posix mutex in lmdb. TSan does not support sysv semaphores, so switch to posix mutex. Also,
disable robust mutexes, since we do not support multi-process access to the database anyway.

TSan does not support sysv semaphores, so switch to posix mutex. Also,
disable robust mutexes, since we do not support multi-process access to
the database anyway.
All calls to `processingCompleted` are called from the unit processing
queue, but `processingAddedPending` can be called from other queues,
including an arbitrary queue in the case of `addUnitOutFilePaths` and
`removeUnitOutFilePaths`.

The result is that if there is a session being processed, we might
increment and decrement `PendingActions` concurrently. We obsevered an
assertion failure where `NumActions` was greater than `NumActions`,
which was likely caused by this race.

rdar://68024910
@benlangmuir benlangmuir requested a review from akyrtzi as a code owner September 1, 2020 18:53
@benlangmuir
Copy link
Contributor Author

@swift-ci please test

@benlangmuir benlangmuir merged commit b68eaae into swiftlang:master Sep 1, 2020
@benlangmuir benlangmuir deleted the racy-assert branch September 1, 2020 21:13
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.

2 participants