gh-116738: Make syslog module thread-safe#136760
Conversation
|
I'm wondering whether these functions are thread safe on other UNIX-like platforms, but I found that on some BSDs (OpenBSD1 and NetBSD) and on AIX2, some of these syslog related functions are not thread safe, and they provide alternative versions with the I'm not sure whether we should add locks for these functions on these platforms, or change the implementations to the But these platforms are not marked as supported in PEP113, so I think this is may not be a big issue for now. Footnotes |
|
@aisk - I think the current implementation should be thread-safe on those platforms on both builds. The GIL provides thread safety on the default build; a critical section provides thread-safety on the free-threaded builds. There is one notable exception, cpython/Modules/syslogmodule.c Lines 242 to 249 in 5f9e38f I think we can address that in a follow up, if needed. |
Make the setlogmask() function in the syslog module thread-safe. These changes are relevant for scenarios where the GIL is disabled or when using subinterpreters.
Make the setlogmask() function in the syslog module thread-safe. These changes are relevant for scenarios where the GIL is disabled or when using subinterpreters.
Make the
setlogmask()function in thesyslogmodule thread-safe. These changes are relevant for scenarios where the GIL is disabled or when using subinterpreters.syslog(),openlog(), andcloselog()in the syslog module are already handled for FT-Python using the@critical_sectionon themodule. However, there might be an issue withsyslog()for subinterpreters on macOS.cpython/Modules/syslogmodule.c
Lines 242 to 245 in 03017a8
I will check/test the macOS subinterpreter and create a separate PR if necessary.
cc: @mpage @colesbury