mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 00:28:21 +00:00
If a thread doesn't terminate, we log that but not longer proceed
(because it could hang later still). Also logging to stderr as well to make sure one sees it. Also adding code to the ASCII writer to catch termination inconsistencies.
This commit is contained in:
parent
1ca0d970fc
commit
c8789cff94
8 changed files with 23 additions and 10 deletions
|
@ -16,6 +16,7 @@ using threading::Field;
|
|||
Ascii::Ascii(WriterFrontend* frontend) : WriterBackend(frontend)
|
||||
{
|
||||
file = 0;
|
||||
ascii_done = false;
|
||||
|
||||
output_to_stdout = BifConst::LogAscii::output_to_stdout;
|
||||
include_meta = BifConst::LogAscii::include_meta;
|
||||
|
@ -51,6 +52,12 @@ Ascii::Ascii(WriterFrontend* frontend) : WriterBackend(frontend)
|
|||
|
||||
Ascii::~Ascii()
|
||||
{
|
||||
if ( ! ascii_done )
|
||||
{
|
||||
fprintf(stderr, "missing finish message\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
// Normally, the file will be closed here already via the Finish()
|
||||
// message. But when we terminate abnormally, we may still have it
|
||||
// open.
|
||||
|
@ -156,6 +163,13 @@ bool Ascii::DoFlush(double network_time)
|
|||
|
||||
bool Ascii::DoFinish(double network_time)
|
||||
{
|
||||
if ( ascii_done )
|
||||
{
|
||||
fprintf(stderr, "duplicate finish message\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
ascii_done = true;
|
||||
CloseFile(network_time);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ private:
|
|||
FILE* file;
|
||||
string fname;
|
||||
ODesc desc;
|
||||
bool ascii_done;
|
||||
|
||||
// Options set from the script-level.
|
||||
bool output_to_stdout;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue