Skip to content

Fix moar deadlocks#243

Merged
lthibault merged 2 commits into
capnproto:mainfrom
zenhack:fix-moar-deadlocks
May 15, 2022
Merged

Fix moar deadlocks#243
lthibault merged 2 commits into
capnproto:mainfrom
zenhack:fix-moar-deadlocks

Conversation

@zenhack

@zenhack zenhack commented May 14, 2022

Copy link
Copy Markdown
Contributor

The results of the debugging session @lthibault and I had the other day.

There are actually three separate deadlock bugs, only two of which we noticed the other day, the third of which we didn't notice but was probably what we were actually observing the symptoms of, and which was way way dumber than the other two and we fixed without even noticing -- see the commit messages.

Note that the diff for rpc.go is an abomination; all it's doing is wrapping a huge block of code in go func() { ... } () and adding a comment, but this simple change is over git's head apparently.

zenhack added 2 commits May 14, 2022 01:22
...just for the remainder of handleReturn off into its own goroutine.

This could use some cleanup -- it's a bit weird that we're holding the
lock and then unlocking it in the goroutine, though I've stared at it
and it's correct. But it should be made clearer.
...by introducing a far less serious bug. See the comments.

This also fixes *another* deadlock, which is far simpler and dumber, and
was in hindsight probably what we were actually seeing when debugging
this: I noticed while making this change we were treating the returned
ReleaseFunc as an *error*, and checking that it was nil before rigging
up the gotResponse() call -- so it would just deterministically not
ever clear used quota.

*Facepalm*

But hey, I found a sublter, more insidious bug while hunting down a
stupid, deterministic one. That's always nice.
@lthibault lthibault merged commit 9d310e1 into capnproto:main May 15, 2022
@zenhack zenhack deleted the fix-moar-deadlocks branch May 15, 2022 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants