[issue32485] Multiprocessing dict sharing between forked processes

André Neto report at bugs.python.org
Wed Jan 3 04:44:21 EST 2018


New submission from André Neto <andre.c.neto at gmail.com>:

I'm working on a project where I need to share state between several processes (forked using gunicorn). I'm using dictionaries obtained from a multiprocessing SyncManager to achieve this.

The issue is that if I have multiple forked processes concurrently accessing to different dictionaries created by the same SyncManager, the code will randomly crash while accessing (read-only and read-write) to any of the dictionaries. This behaviour is independent of the way I access the dictionary (i.e. it happens both using the dictionary functions (e.g. has_key) or the built-in keywords (e.g. key in dict).

The attached snippet demonstrates the issue (tested only in python2.7): the function test_manyForkedProcessesSingleThreaded will crash.

The issue is also being discussed here: https://stackoverflow.com/questions/48052148/python-multiprocessing-dict-sharing-between-processes

----------
files: multiprocessing_crash.py
messages: 309402
nosy: André Neto
priority: normal
severity: normal
status: open
title: Multiprocessing dict sharing between forked processes
type: crash
versions: Python 2.7
Added file: https://bugs.python.org/file47361/multiprocessing_crash.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32485>
_______________________________________


More information about the Python-bugs-list mailing list