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

Program cannot be interrupted when bugsnag-go is imported #249

Closed
shanesmith opened this issue Oct 7, 2024 · 3 comments
Closed

Program cannot be interrupted when bugsnag-go is imported #249

shanesmith opened this issue Oct 7, 2024 · 3 comments
Labels
bug Confirmed bug released This feature/bug fix has been released

Comments

@shanesmith
Copy link

Describe the bug

With bugsnag-go imported the program cannot be interrupted (ie: Ctrl-C).

This was introduced in #231, specifically with this line:

signal.Notify(signalsCh, syscall.SIGINT, syscall.SIGTERM)

This traps SIGINT and sends a signal to the channel, but will also disable the default handling of the signal which is to kill the program.

Also note that the issue is encountered as soon as the bugsnag-go module is imported, the module doesn't otherwise need to be actually used.

Steps to reproduce

  • With the following simple program:
go.mod
module foo

go 1.23.2

require (
	github.com/bugsnag/bugsnag-go/v2 v2.5.0 // indirect
	github.com/bugsnag/panicwrap v1.3.4 // indirect
	github.com/google/uuid v1.6.0 // indirect
	github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
	github.com/pkg/errors v0.9.1 // indirect
)
go.sum
github.com/bitly/go-simplejson v0.5.1/go.mod h1:YOPVLzCfwK14b4Sff3oP1AmGhI9T9Vsg84etUnlyp+Q=
github.com/bugsnag/bugsnag-go/v2 v2.5.0 h1:kOf+3Rlv7KRrgaYj26GKvSntVeJrB2xQXvqfK0efojA=
github.com/bugsnag/bugsnag-go/v2 v2.5.0/go.mod h1:S9njhE7l6XCiKycOZ2zp0x1zoEE5nL3HjROCSsKc/3c=
github.com/bugsnag/panicwrap v1.3.4 h1:A6sXFtDGsgU/4BLf5JT0o5uYg3EeKgGx3Sfs+/uk3pU=
github.com/bugsnag/panicwrap v1.3.4/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA=
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
// main.go
package main

import (
  "fmt"
  "time"

  _ "github.com/bugsnag/bugsnag-go/v2"
)

func main() {
  fmt.Println("Waiting...")
  time.Sleep(10 * time.Second)
  fmt.Println("...done")
}
  • Run it, then hit Ctrl-C
$ go run main.go
Waiting...
^C...done
  • Note that the program did not exit and ^C was instead printed

  • Comment out the bugsnag-go import and try again, the program will exit

Environment

  • Bugsnag Go version: 2.5.0
  • Go version: 1.23.1
@RobertoSmartBear
Copy link

Hi @shanesmith ,

Thanks for bringing this to our attention. Our engineers were able to reproduce the problem and found the fix. It will likely be released next week, and we'll let you know here on the thread when it happens.

@shanesmith
Copy link
Author

Amazing, much appreciated!

@mclack
Copy link

mclack commented Oct 22, 2024

Hi @shanesmith

We have now released v2.5.1 of bugsnag-go which removes our usage of signal.Notify, and should resolve this issue: https://github.com/bugsnag/bugsnag-go/releases/tag/v2.5.1

I hope that helps. Please do let us know if you continue to notice any issues after upgrading bugsnag-go.

@mclack mclack closed this as completed Oct 22, 2024
@mclack mclack added the released This feature/bug fix has been released label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug released This feature/bug fix has been released
Projects
None yet
Development

No branches or pull requests

3 participants