New submission from Joseph Sible <josephcsi...@gmail.com>:

When Python is built on Alpine Linux or in any other configuration that uses 
musl libc, calls to Lock.acquire() can't be interrupted by signals. This bug is 
caught by test_lock_acquire_interruption and test_rlock_acquire_interruption in 
3.6/Lib/test/test_threadsignals.py, both of which fail when Python is built on 
musl.

POSIX explicitly says that sem_timedwait ever failing with EINTR is optional:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_timedwait.html#tag_16_508_05

And musl deliberately chooses not to support it:
http://www.openwall.com/lists/musl/2018/02/24/3
http://git.musl-libc.org/cgit/musl/commit/?id=c0ed5a201b2bdb6d1896064bec0020c9973db0a1

However, we incorrectly rely on it for correct operation. Our documentation 
https://docs.python.org/3.6/library/threading.html#threading.Lock.acquire just 
says that "Lock acquires can now be interrupted by signals on POSIX", not that 
any optional POSIX features are required for it.

A similar bug was #11223, which was the same problem but with 
pthread_cond_timedwait, which is used when semaphores aren't available.

----------
components: Extension Modules
messages: 320742
nosy: Joseph Sible
priority: normal
severity: normal
status: open
title: Acquiring locks not interrupted by signals on musl libc
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34004>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to