@@ -1325,6 +1325,14 @@ Log::va_error(const char *format, va_list ap)
13251325 return ret_val;
13261326}
13271327
1328+ void
1329+ Log::flush_all_objects ()
1330+ {
1331+ if (config) {
1332+ config->log_object_manager .flush_all_objects ();
1333+ }
1334+ }
1335+
13281336/* -------------------------------------------------------------------------
13291337 Log::preproc_thread_main
13301338
@@ -1343,9 +1351,6 @@ Log::preproc_thread_main(void *args)
13431351 Log::preproc_notify[idx].lock ();
13441352
13451353 while (true ) {
1346- if (TSSystemState::is_event_system_shut_down ()) {
1347- return nullptr ;
1348- }
13491354 LogConfig *current = static_cast <LogConfig *>(configProcessor.get (log_configid));
13501355
13511356 if (likely (current)) {
@@ -1360,6 +1365,13 @@ Log::preproc_thread_main(void *args)
13601365 configProcessor.release (log_configid, current);
13611366 }
13621367
1368+ // Drain any remaining buffers before exiting on shutdown.
1369+ if (TSSystemState::is_event_system_shut_down ()) {
1370+ // Signal flush thread to drain data we just pushed.
1371+ Log::flush_notify->signal ();
1372+ return nullptr ;
1373+ }
1374+
13631375 // wait for more work; a spurious wake-up is ok since we'll just
13641376 // check the queue and find there is nothing to do, then wait
13651377 // again.
@@ -1384,9 +1396,6 @@ Log::flush_thread_main(void * /* args ATS_UNUSED */)
13841396 Log::flush_notify->lock ();
13851397
13861398 while (true ) {
1387- if (TSSystemState::is_event_system_shut_down ()) {
1388- return nullptr ;
1389- }
13901399 fdata = static_cast <LogFlushData *>(ink_atomiclist_popall (flush_data_list));
13911400
13921401 // invert the list
@@ -1478,6 +1487,10 @@ Log::flush_thread_main(void * /* args ATS_UNUSED */)
14781487 // check the queue and find there is nothing to do, then wait
14791488 // again.
14801489 //
1490+ if (TSSystemState::is_event_system_shut_down ()) {
1491+ return nullptr ;
1492+ }
1493+
14811494 Log::flush_notify->wait ();
14821495 }
14831496
0 commit comments