New submission from Maxime Belanger <m...@dropbox.com>:

Through the use of various Python packages (such as `pyobjc`), it is possible 
for a deadlock to occur due to how `_scproxy.c` calls 
`SCDynamicStoreCopyProxies`.

In more recent versions of macOS (10.7+), this function can block on acquiring 
a lock deep inside `NSUserPreferences`. As `pyobjc` allows Python-wrapped 
`NSString`s to be stored in `CFPreferences`, it is thus possible for one thread 
to hold the `CFPreferences` lock and block on the GIL while another thread 
holds the GIL and blocks on the `CFPreferences` lock.

We've observed this on a significant number of macOS devices before fixing 
ourselves by wrapping the calls to `SCDynamicStoreCopyProxies` with 
`Py_BEGIN/END_ALLOW_THREADS`.

----------
components: macOS
messages: 305247
nosy: Maxime Belanger, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: `_scproxy` calls SystemConfiguration functions in a way that can cause 
deadlocks
type: crash
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7

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

Reply via email to