Files
Sergii Tkachenko 0a3681052b gRPC test DNS server: Synchronize shutdown to prevent data races
To avoid data races and use-after-free on shutdown in Python 3.13.
It seems to have worked before due to unintended guarantees of the
Python interpreter that are gone with the new version.

Uses `threading.Event` and `threading.Lock` to coordinate between the main thread handling signals and the `flush_stdout_loop` thread. The `_quit_on_signal` handler now signals the flush thread to exit, and waits for the flush thread to complete its current sleep cycle before calling `sys.exit()`. This prevents a use-after-free that shows up as a data race.

Ref b/474047558

PiperOrigin-RevId: 859182150
2026-01-21 11:15:46 -08:00
..