bazel-contrib / rules_go

Go rules for Bazel
Apache License 2.0
1.38k stars 656 forks source link

fix(timeout.go): remove redundant leaked go func in RegisterTimeoutHandler #4004

Closed Roytangrb closed 2 months ago

Roytangrb commented 2 months ago

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

Fix #4003

The removed goroutine is redundant and will fail user code tests where timeout or sigterm do no happen.

IIUC, we only need to register a noop handler for sigterm signal for bazel to gracefully shutdown in case of a test timeout and signal.Notify(c, signal.SIGTERM) create a strong reference to prevent c from being GCed when RegisterTimeoutHandler returns.

Which issues(s) does this PR fix?

Fixes #4003

Other notes for review

Tested with my own repo tests and a simple time.Sleep ran with --test_timeout

google-cla[bot] commented 2 months ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Roytangrb commented 2 months ago

@fmeum CLA signed, CLA check passed.

Test is failing for a different target per last trigger tho. I dont' seem to have permission to rerun