[issue37652] Multiprocessing shared_memory ValueError on race with ShareableList

mental report at bugs.python.org
Fri Jul 26 21:27:06 EDT 2019


mental <m3nta1 at yahoo.com> added the comment:

> The root of the error is that struct.pack_into starts by memsetting the underlying memory area with NULL bytes before filling the data with memcpy.

I've had a fix spinning for about a day now, it introduced a `multiprocessing.Lock` and it was simply wrapped around any struct packing and unpacking calls.

I've been reluctant to submit anything due to a suspicious resource warning I kept seeing about leaked shared_memory objects appearing spuriously and I wanted to rule out the possibility that other tests were causing a side effect.

Also I wanted to hear an expert from the noisy list share their thoughts.

> I'm not sure this should be done internally

I agree, even with my patch not reproducing the issue I didn't like placing a lock around various components in the class.

> +1 For a documentation addition.

If there are no objections, I'll submit a PR with a doc update :)

@Pierre mind if I cc' you for a review?

----------

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


More information about the Python-bugs-list mailing list