Create log timestamps in UTC to avoid local-time races

Use getTime().utc in both message constructors, document the timezone change, and cover concurrent construction and structured formatting. Restore ordinary logging calls in the parallel writer fixture.

Validation: 32 unit tests and 29 regression tests pass. Timestamp sanitizer checks pass under UTC and non-UTC timezones. The full suite retains the known allocator reports in factory-state and allocator.
This commit is contained in:
jdb committed 2026-09-29 09:03:31 -05:00
1 parent 011780e6ab
commit 46245b3f1e
6 files changed
+48 -17

No files matched your search

+7 -6
View File
@@ -54,9 +54,11 @@ checks that each worker maintains its own counter. `collector` concurrently
records messages containing JSON and exceptions and mutates returned snapshots.
These ownership scenarios use explicit timestamps where messages are needed.
The separate `timestamp` case exercises concurrent `initLogMessage()` calls. It
currently exposes a sanitizer report in libc local-time conversion reached via
Nim's `std/times.now()`; this remains a separate thread-safety issue.
The separate `timestamp` case exercises both `initLogMessage()` overloads and
structured JSON formatting concurrently. Generated timestamps use UTC, avoiding
the libc local-time conversion race previously reached via `std/times.now()`.
The timestamp regressions verify the captured instant, UTC timezone, and `Z`
suffix in structured output.
`allocator` calls the standalone reproduction in `runtime_allocator.nim`, which
imports no logging code. It exercises sequence growth and clearing under a lock
@@ -117,9 +119,8 @@ The suite provides targeted regressions; it does not exhaust thread scheduling
or ORC cycle-collector interleavings.
The ownership scenarios, lifetime suite, and appender-state cleanup regression
exercise the new ownership contracts. Local-time timestamp construction and
allocator reports remain for
subsequent work.
exercise the new ownership contracts. Allocator reports remain for subsequent
work.
The standalone `ownership.nim` regression suite passed AddressSanitizer and
LeakSanitizer with `--mm:orc -d:useMalloc`. An additional worker-thread build found