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
@@ -2,6 +2,7 @@
|
||||
set -u
|
||||
|
||||
binary=${1:?Expected the ThreadSanitizer test executable}
|
||||
writer_binary=${2:?Expected the writer lifecycle test executable}
|
||||
result=0
|
||||
for scenario in independent service service-lifetime service-reconfigure custom-state formatter shared-state-lifetime factory-state collector formatter-lifetime timestamp allocator; do
|
||||
echo "ThreadSanitizer scenario: $scenario"
|
||||
@@ -13,4 +14,13 @@ for scenario in independent service service-lifetime service-reconfigure custom-
|
||||
result=1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "ThreadSanitizer scenario: writer-lifecycle"
|
||||
if TSAN_OPTIONS=halt_on_error=1:exitcode=66 timeout 30s "$writer_binary" 'Background writer lifecycle::*'; then
|
||||
echo "PASS: writer-lifecycle"
|
||||
else
|
||||
code=$?
|
||||
echo "FAIL: writer-lifecycle (exit $code)" >&2
|
||||
result=1
|
||||
fi
|
||||
exit "$result"
|
||||
Reference in new issue
Block a user