-
Notifications
You must be signed in to change notification settings - Fork 70
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
Existing async notify reports disappear if app exits. No apparent way to flush them. #200
Comments
Hi @veqryn Due to a race condition between the parent(application) and child(monitoring) fork there is a possibility that some reports may be lost as the parent process terminates the child process before it has a chance to flush and report all errors to BugSnag. |
Hi, |
@clr182 Please re-open, I don't have the ability to. |
Yeah this is a reallyyyy painful design, if it's gonna stay this way I think it's worth being very explicit about the implications of not use the synchronous configuration in all the official on site docs (maybe even making it default to synchronous as a breaking change.) |
@SpencerMalone I created a library to fix this issue, and it also acts as a slog middleware (golang's structured logging) to automatically send your logs to bugsnag if they are at Error level or higher (configurable). It allows flushing the errors to bugsnag before exit. You should check it out: https://github.com/veqryn/slog-bugsnag |
Ha, we did a similar thing, but with Zap as we have some pre-slog apps that haven't been ported over yet. I'll take a look when we get around to wholesale adoption of slog! |
Describe the bug
A default configuration of bugsnag (Synchronous = false) will drop notify reports if the app exits.
There does not appear to be any way to flush these notify reports, or to delay the exit of the application until they have been sent.
Steps to reproduce
The above golang application will print "done", but no bugs will show up in bugsnag.
If you add
time.Sleep(120*time.Second)
to the end of it, the bugs will start showing up in bugsnag.Bugsnag should probably have a buffered channel accumulating errors, with a worker pool publishing the channels to bugsnag's servers. There should be a function you can call that waits for the channel to be empty, or closes the channel and waits for the workers to finish consuming from the channel and exit.
Environment
The text was updated successfully, but these errors were encountered: