[New-bugs-announce] [issue37652] Multiprocessing shared_memory ValueError on race with ShareableList

Ben report at bugs.python.org
Mon Jul 22 11:13:18 EDT 2019


New submission from Ben <benjsimner at gmail.com>:

When running the attached on 3.8 and 3.9 (master) I get the following:

Process Process-3:
Traceback (most recent call last):                                                                                                                       
  File "/home/bjs/.pyenv/versions/3.9-dev/lib/python3.9/multiprocessing/process.py", line 313, in _bootstrap
    self.run()    
  File "/home/bjs/.pyenv/versions/3.9-dev/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/bjs/Downloads/e4671450a50df5a0648c6dda0c7b642a-3db67c29d8d9e6a6d629c2c016f5853ec22000ed/test.py", line 14, in g
    X[0]
  File "/home/bjs/.pyenv/versions/3.9-dev/lib/python3.9/multiprocessing/shared_memory.py", line 413, in __getitem__
    (v,) = struct.unpack_from(
ValueError: not enough values to unpack (expected 1, got 0)

(Tested on Windows and Linux)

Either this is a documentation error,  and the docs for shared_memory should state that the ShareableList does not have atomic operations and so this is unsafe,  or this is a suspicious behaviour.  I'm not sure which.

I could also just be using the library totally incorrectly.

----------
files: test.py
messages: 348299
nosy: bjs
priority: normal
severity: normal
status: open
title: Multiprocessing shared_memory ValueError on race with ShareableList
type: behavior
versions: Python 3.8, Python 3.9
Added file: https://bugs.python.org/file48496/test.py

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


More information about the New-bugs-announce mailing list