Modify

Opened 4 years ago

Closed 4 years ago

#10638 closed Bugs (fixed)

unhandled exception in async sink, created by init_from_settings

Reported by: pal666@… Owned by: Andrey Semashev
Milestone: To Be Determined Component: log
Version: Boost 1.56.0 Severity: Problem
Keywords: Cc:

Description

when settings file describes async file sink pointing to inaccessible location, async sink will be created without exception handler and will throw unhandled exception from async thread, killing application. easiest way to fix it is to add exception suppressor to async sinks, created by init_from_settings. i.e.

        else {
            p = init_formatter(boost::make_shared< sinks::asynchronous_sink< backend_t > >(backend), params, is_formatting_t());
            p -> set_exception_handler ( make_exception_suppressor ( ) );
	}

instead of

        else
            p = init_formatter(boost::make_shared< sinks::asynchronous_sink< backend_t > >(backend), params, is_formatting_t());

Attachments (0)

Change History (3)

comment:1 Changed 4 years ago by Andrey Semashev

You can register your own sink factory and configure the sink the way you need. The default factory doesn't set any exception handler because there is no good default one.

comment:2 Changed 4 years ago by anonymous

well, registering new factories will mean reimplement/copypaste all init_from_settings.cpp. btw we are not talking about default behavior, we are talking about the behavior, since it is impossible to add/change exception handler afterwards afaik. the only other way to change exception handler is ... to register new factories, which will not use code in question anyway. to me it looks like suppressing exception is much better than just killing application. we are talking about suppressing only those exceptions which otherwise will kill application. basically my suggestion boils down to "suppress instead of dying", i fail to see downsides.

comment:3 Changed 4 years ago by Andrey Semashev

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Andrey Semashev.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.