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

x/simulation: make signals channel buffered to avoid missing signals #7952

Merged
merged 2 commits into from
Nov 17, 2020

Conversation

odeke-em
Copy link
Collaborator

Invoking:

c := make(chan os.Signal)
signal.Notify(c, signals...)

is explicitly called out as a bug in the os/signal docs
and should instead make that channel buffered lest
a signal could be lost.

Fixes #7950

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

Invoking:

    c := make(chan os.Signal)
    signal.Notify(c, signals...)

is explicitly called out as a bug in the os/signal docs
and should instead make that channel buffered lest
a signal could be lost.

Fixes #7950
@codecov
Copy link

codecov bot commented Nov 17, 2020

Codecov Report

Merging #7952 (034045d) into master (0647d89) will not change coverage.
The diff coverage is 0.00%.

@@           Coverage Diff           @@
##           master    #7952   +/-   ##
=======================================
  Coverage   54.14%   54.14%           
=======================================
  Files         612      612           
  Lines       39029    39029           
=======================================
  Hits        21134    21134           
  Misses      15720    15720           
  Partials     2175     2175           

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

utACK

@alexanderbez alexanderbez added the A:automerge Automatically merge PR once all prerequisites pass. label Nov 17, 2020
@mergify mergify bot merged commit 9369a00 into master Nov 17, 2020
@mergify mergify bot deleted the x-simulation-fix-unbuffered-signals-channel branch November 17, 2020 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

x/simulation: unbuffered os.Signal channel passed into signal.Notify isn't correct
3 participants