Skip to content
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

Fix deadlock #316

Merged
merged 2 commits into from
Oct 1, 2022
Merged

Fix deadlock #316

merged 2 commits into from
Oct 1, 2022

Commits on Sep 30, 2022

  1. Fix a deadlock.

    It is illegal to resolve promises while holding connection locks, and I
    was seeing TestHandleReturn_regression deadlock every 6th run or so;
    changing this fixes it.
    
    Note: since this makes the resolution itself and the manipulation of
    the questions table non-atomic, the ordering is critical:
    
    1. First we remove the entry from the table. This means that if the
    remote vat sends us messages pertaining to that question id, they will
    simply be rejected instead being acted on. This shouldn't happen
    normally, but maybe a malicious vat could get us to panic or something.
    2. Second, resolve the promise. After this is complete, we can be sure
    the client won't be used.
    3. Then, and only then, we can return the question id to the pool for
    re-use.
    zenhack committed Sep 30, 2022
    Configuration menu
    Copy the full SHA
    4107515 View commit details
    Browse the repository at this point in the history
  2. Fix similar ordering issues.

    Unlike the previous commit, I haven't observed the consequences of
    these, but the same logic & ordering constraints apply.
    zenhack committed Sep 30, 2022
    Configuration menu
    Copy the full SHA
    d6d1617 View commit details
    Browse the repository at this point in the history