Version française
Home     About     Download     Resources     Contact us    
Browse thread
Strangeness with atexit and exception backtraces
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Michael Ekstrand <michael@e...>
Subject: Strangeness with atexit and exception backtraces
I have been using the Bolt logging library[1] lately in my code, but
have encountered a difficulty with debugging programs.  Bolt uses an
atexit handler to close all open log files when the program shuts down.
 However, if an uncought exception is encountered with this atexit
handler in place, the program terminates with status 2 but neither the
exception value nor its backtrace (with OCAMLRUNPARAM=b) are printed.

If I disable the atexit handler, the error information is printed as I
expect.

I am currently working around this by modifying Bolt so that the atexit
handler is disabled if OCaml starts up with stack traces enabled.  I am
wondering, though, if this is a known bug (or limitation)?  Is there
another workaround, or a fix on the horizon?  Or should I go file the
appropriate report in the OCaml bugtracker?

Thanks,
- Michael