-
Notifications
You must be signed in to change notification settings - Fork 14
CP-28365: improve backtraces by using finally #32
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
Conversation
Signed-off-by: Edwin Török <edvin.torok@citrix.com>
`Backtrace.is_important` was not called. We have a `finally` function that does the proper thing wrt to backtraces, use it. xapi-stdext-pervasives is a dependency of xapi-stdext-threads already, so this does not introduce a new dependency. Signed-off-by: Edwin Török <edvin.torok@citrix.com>
Signed-off-by: Edwin Török <edvin.torok@citrix.com>
We've got a `with_file` in this same file, use it instead of reimplementing it, so we get the improved backtraces. Signed-off-by: Edwin Török <edvin.torok@citrix.com>
We cannot use finally here, because the socket is only closed on failure. Signed-off-by: Edwin Török <edvin.torok@citrix.com>
Signed-off-by: Edwin Török <edvin.torok@citrix.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! After this is merged, can you please tag and release a new version of xapi-stdext-threads and xapi-stdext-unix in xs-opam?
|
I just noticed that there is a typo in the commits, sorry. |
|
|
||
| (** daemonize a process *) | ||
| (* !! Must call this before spawning any threads !! *) | ||
| let daemonize () = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should really deprecate this function... nowadays it's systemd duty to damonize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened a ticket, CP-28369
| (fun () -> Unix.close fd) | ||
|
|
||
| (** open a file, and make sure the close is always done *) | ||
| let with_file file mode perms f = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could even expose this in the interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it's there!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It already is, I just moved it.
Stacktraces were lost in functions wrapped with
Mutex.execute:The
Pervasiveext.finallyfunction already does the right thing and callsBacktrace.is_important exnto not loose the stacktrace, so update all the handcoded finally functions to use our own finally.