[SourceKit] Jump to a background queue before executing SKDUIDFromUIdent
#66441
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.
requestIsEnableBarriers
andrequestIsBarrier
callSKDUIDFromUIdent
. What I didn’t know, was thatSKDUIDFromUIdent
can send XPC requests to the client to translate UIDs viasourcekitd_set_uid_handlers
.Since we were calling
requestIsEnableBarriers
directly from the XPC server’s main queue, and the UID handler sends an XPC request synchronously, we could get into a deadlock situation.Immediately jump onto a serial background queue (
msgHandlingQueue
) insourcekitdServer_peer_event_handler
so that the main queue is free to execute the UID handler. This more closely matches the behavior before I introduced barriers as well, where we were always immediately jumping onto a concurrrentmsgHandlingQueue
.I think the best way to review this it to look at the combined diff of #66013 and this PR 208eaac...ahoppen:swift:ahoppen/deadlock#diff-0ef1fa70c987d3bee8fd247f1fe85ca4f3ae5ba089da80000753a9cb503ab269