Boost logo

Boost :

Subject: Re: [boost] Stacktrace review: concern, probable solution and review news
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2016-12-23 14:08:52


Sorry, accidentally send the unfinished previous mail. Here's the full version:

2016-12-22 23:06 GMT+03:00 Vladimir Batov <Vladimir.Batov_at_[hidden]>:
>
>
> On 12/22/2016 10:21 AM, Andrey Semashev wrote:
>
>> ...
>>
>> The idea is that the stack-based allocator is used in a signal
>> handler. The stacktrace created in that context cannot escape the
>> signal handler and can be used e.g. to save the backtrace to a file.
>
> I hate to sound like a broken record but every time I read "to a file"
> I get concerned as it does not seem to fit our deployment case. Airline
> scheduling and disruption management. There are people on call 24/7 to
> address the situations when our s/w crashes. The operators have no
> issues/difficulties with the logs and, in fact, they send us those
> automatically without asking. It is really a stretch expecting them to
> find, handle, copy files or to run an extra application. Probably doable
> but I am not convinced. So, retrieving such a file from their secured
> system will be a royal pain. I might have missed that but dumping the
> textual stack-trace to the log is still on the cards, right?

Actually, I think that Stacktrace must perfectly fit your needs.
Here's how I understand your situation: you've got a big application,
that runs 24/7 and is automatically restarted after a crash; a support
team of non-developers that monitor it and send logs. It would be a
disaster if your application hangs, so you need an async-signal-safe
code. Sending corefiles is hard - application is big and support team
is not trained to do that. Log files with a stacktrace would
significantly help you in debugging.

Here's how you can use the stacktrace:

dump_stacktrace("/staktrace.txt"); // in signal handler, async signal safe

...
// in main()
if (filesystem::exists("/staktrace.txt")) {
    std::ifstream ifs("/staktrace.txt");
    ifs >> stacktrace_variable; // pseudo code, have not thought it
fully through
    log << stacktrace; // outputting stacktrace of previous crash with
all the function names and source lines
    ifs.close();
    filesystem::remove("/staktrace.txt");
}

This will give you the stacktrace of the previous crash in 100% safe
manner that avoids hangs without any manual work from the support
team.

-- 
Best regards,
Antony Polukhin

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk