Skip to content

Conversation

@edwintorok
Copy link
Contributor

Stacktraces were lost in functions wrapped with Mutex.execute:

Raised at file \"lib/xapi-stdext-pervas
ives/pervasiveext.ml\", line 26, characters 6-15\nCalled from file \"lib/xapi-stdext-threads/threadext.ml\", line 21, characters 22-26\nRe-raised at file \"lib/xapi-stdext-threads/thre
adext.ml\", line 21, characters 58-67\nCalled from file \"lib/debug.ml\", line 287, characters 8-12\n

The Pervasiveext.finally function already does the right thing and calls Backtrace.is_important exn to not loose the stacktrace, so update all the handcoded finally functions to use our own finally.

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>
Copy link
Collaborator

@mseri mseri left a 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?

@mseri mseri merged commit 163c59a into xapi-project:master May 30, 2018
@coveralls
Copy link

Pull Request Test Coverage Report for Build 42

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 98.649%

Totals Coverage Status
Change from base Build 40: 0.0%
Covered Lines: 73
Relevant Lines: 74

💛 - Coveralls

@mseri
Copy link
Collaborator

mseri commented May 30, 2018

I just noticed that there is a typo in the commits, sorry.


(** daemonize a process *)
(* !! Must call this before spawning any threads !! *)
let daemonize () =
Copy link
Collaborator

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

Copy link
Contributor Author

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 =
Copy link
Collaborator

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, it's there!

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants