Boost logo

Boost :

Subject: Re: [boost] [log] Segfault in "rotating_file" example
From: Jason Roehm (jasonr_at_[hidden])
Date: 2013-04-16 16:48:51

On 04/16/2013 04:38 PM, Andrey Semashev wrote:
> Well, from the backtrace it seems like the library tries to perform the last
> file rotation and calls filesystem::path::parent_path at some point, which
> tries to construct a path and access a locale facet for character code
> conversion. The problem is that the locale is stored as a function-local
> static in Boost.Filesystem and is destroyed at this point.
> I think this should be reported to Boost.Filesystem maintainer as this
> limitation with a global locale is quite unexpected from a user's standpoint.
> I think there is also a thread safety issue related to it that I reported
> quite some time ago, and it is still not fixed.
> As for Boost.Log, I'm not sure I can work it around in my code, except to
> avoid using Boost.Filesystem, which would be unfortunate. You can try to work
> around it on yor side though. If you access filesystem::path in the way so
> that the locale gets initialized _before_ you make any use of Boost.Log, then
> the locale should still be valid when Boost.Log is deinitialized.

Thanks for the recommendation. I wasn't able to figure out how to access
filesystem::path appropriately in order to keep the locale alive, but I
did create a workaround. Just before application shutdown, I call a
function that explicitly removes the sinks from the logging core, which
then causes them to be destroyed. The application then shuts down
successfully without any problems.


Boost list run by bdawes at, gregod at, cpdaniel at, john at