mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Fix log manager hanging on waiting for pending file rotations.
This changes writer implementations to always respond to rotation messages in their DoRotate() method, even for failure/no-op cases with a new RotationFailedMessage. This informs the manager to decrement its count of pending rotations. Addresses #860.
This commit is contained in:
parent
4bdac985cb
commit
4359bf6b42
8 changed files with 79 additions and 1 deletions
|
@ -1215,12 +1215,16 @@ bool Manager::Flush(EnumVal* id)
|
|||
void Manager::Terminate()
|
||||
{
|
||||
// Make sure we process all the pending rotations.
|
||||
while ( rotations_pending )
|
||||
|
||||
while ( rotations_pending > 0 )
|
||||
{
|
||||
thread_mgr->ForceProcessing(); // A blatant layering violation ...
|
||||
usleep(1000);
|
||||
}
|
||||
|
||||
if ( rotations_pending < 0 )
|
||||
reporter->InternalError("Negative pending log rotations: %d", rotations_pending);
|
||||
|
||||
for ( vector<Stream *>::iterator s = streams.begin(); s != streams.end(); ++s )
|
||||
{
|
||||
if ( ! *s )
|
||||
|
@ -1384,3 +1388,11 @@ bool Manager::FinishedRotation(WriterFrontend* writer, const char* new_name, con
|
|||
return result;
|
||||
}
|
||||
|
||||
bool Manager::FailedRotation(WriterFrontend* writer, const char* filename,
|
||||
double open, double close, bool terminating)
|
||||
{
|
||||
--rotations_pending;
|
||||
DBG_LOG(DBG_LOGGING, "Failed rotating writer '%s', file '%s' at %.6f,",
|
||||
writer->Name(), filename, network_time);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue