Drain background writers before process exit
Serialize writer submission and shutdown, enqueue explicit stop messages after accepted records, and finish the final file batch before joining. Keep drained process-wide channel storage until exit to avoid the Nim 2.2.10 Channel.close mutex teardown defect. Cover empty records, multiple destinations, joined producers, and concurrent shutdown. Include writer lifecycle sanitizer tests in nimble test and update usage documentation. Validation: all 32 unit tests, eight writer exit scenarios, and writer lifecycle ThreadSanitizer tests pass. The full suite retains the known configuration refresh, timestamp, and default allocator failures.
This commit is contained in:
1 parent
b2d0e9dade
commit
d5e3b9c301
7 files changed
+241
-125
No files matched your search
@@ -303,6 +303,10 @@ remains available while any service copy, local service, or logger using that
|
||||
service remains alive. Join worker threads before exiting the application so
|
||||
they have an opportunity to finish logging.
|
||||
|
||||
When background writers are enabled with `-d:multithreaded`, normal application
|
||||
exit drains the console and file queues and waits for the writers to finish.
|
||||
No explicit flush or delay is needed after joining the threads that log.
|
||||
|
||||
You can change logging configuration through a service copy or a local service
|
||||
in any thread. Those changes are intended to take effect automatically on
|
||||
subsequent logging calls in every thread using that service, without recreating
|
||||
@@ -311,10 +315,9 @@ loggers or configuring each worker separately.
|
||||
> [!NOTE]
|
||||
> Thread-safety work is still in progress. Custom state and captured
|
||||
> formatters must follow the ownership rules above. Runtime configuration
|
||||
> refresh, concurrent local-time timestamp construction, and delivery of queued
|
||||
> background output at application exit still have known failures. Nim 2.2.10
|
||||
> also produces sanitizer reports in its default allocator during some
|
||||
> cross-thread allocation patterns. See
|
||||
> refresh and concurrent local-time timestamp construction still have known
|
||||
> failures. Nim 2.2.10 also produces sanitizer reports in its default allocator
|
||||
> during some cross-thread allocation patterns. See
|
||||
> [the regression tests](tests/README.md) for the remaining work.
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user