Skip to content

Go back to waiting for override descriptor.proto with all other deps#115

Merged
jhump merged 1 commit intomainfrom
jh/fix-deadlock
Mar 7, 2023
Merged

Go back to waiting for override descriptor.proto with all other deps#115
jhump merged 1 commit intomainfrom
jh/fix-deadlock

Conversation

@jhump
Copy link
Member

@jhump jhump commented Mar 7, 2023

In #109, trying to be clever, I moved the place where we block for an override descriptor.proto to "just in time", before options are interpreted. That seemed like a potential latency improvement to allow compilation of the override descriptor.proto to overlap with the linking of the file in question, if the file in question didn't actually directly depend on descriptor.proto.

But this decision caused a deadlock that is not reproducible in the tests in this repo: https://github.com/bufbuild/buf/actions/runs/4357071661/jobs/7615922964

So I've reverted that one change, which was the only change even slightly related to concurrency. It turns out that this deadlocks because we now have a situation where the file might block for the result of another file, but while holding on to the semaphore! In order to eliminate the deadlock, an alternative would have been to release the semaphore before blocking for the override file (and then re-acquire it again after the override file result is available).

Oops.

@jhump jhump requested a review from pkwarren March 7, 2023 19:16
Copy link
Member

@pkwarren pkwarren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Should've seen this earlier.

@jhump jhump merged commit 583d154 into main Mar 7, 2023
@jhump jhump deleted the jh/fix-deadlock branch March 7, 2023 19:25
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