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

Handle context cancellation properly (#428) #2

Merged
merged 1 commit into from
Aug 23, 2023

Conversation

hannahhoward
Copy link
Collaborator

BACKPORT FROM UPSTREAM

Issue description in original PR

* fix(cancellation): handle message cancellation properly

a previous fix ipfs#391, attempted to address a lock that occurred on context cancel. however in doing
so, it introduced a new lock. essentially, if a message was not sent to the
requestmanager/responsemanager go routine, waiting for a response to that message could last
indefinitely. the previous fix therefore stopped waiting when the calling context cancelled. However
once a message reaches the go routine of the requestmanager/responsemanager, it's important that
it's processed to completion, so that the the message loop doesn't lock. The proper fix is to detect
when the message is sent successfully, and if so, wait for it to be processed. If it isn't sent, we
can safely abort the go routine immediately.

* fix(race): resolve race condition with test responses
@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (release/v0.13.x@226a4d3). Click here to learn what that means.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##             release/v0.13.x       #2   +/-   ##
==================================================
  Coverage                   ?   63.21%           
==================================================
  Files                      ?       73           
  Lines                      ?     7947           
  Branches                   ?        0           
==================================================
  Hits                       ?     5024           
  Misses                     ?     2736           
  Partials                   ?      187           

@dirkmc dirkmc merged commit cb442d6 into release/v0.13.x Aug 23, 2023
@dirkmc dirkmc deleted the fix/context-cancel branch August 23, 2023 08:00
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.

3 participants