This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.moore
Recipients Kallah, eryksun, paul.moore, steve.dower, steven.daprano, tim.golden, zach.ware
Date 2020-01-08.19:53:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1578513222.27.0.424708782807.issue39255@roundup.psfhosted.org>
In-reply-to
Content
For me, I headed straight for "Sharing state between processes" and the "Shared memory" object. That's probably because I was reviewing someone else's code, rather than writing my own, but nevertheless when coding I do tend to dive straight for the section that describes what I want to do, and miss "overview" type discussions.

The way the shared memory object is described, it reads that it is just that - shared. And so I'd assume that if a shared memory object is in multiple processes in a pool, it would be the *same* shared memory region, and the value would be accessible from all the processes.

From there, for me at least, it's easy to proceed to the mistake of thinking that the global initialisation of the x and y variables creates the *same* shared memory objects in each process in the pool. Clearly it doesn't, hence this is "not a bug" but for me it's an easy mistake to make.

Maybe it would be enough just to add a comment to the shared memory object documentation that said "every shared memory object is independent - there is no way to create a reference to the same shared memory object in multiple processes, instead you need to create the object in one process and pass it to all of the others". That would probably have made me stop and think long enough to not make the mistake I did.
History
Date User Action Args
2020-01-08 19:53:42paul.mooresetrecipients: + paul.moore, tim.golden, steven.daprano, zach.ware, eryksun, steve.dower, Kallah
2020-01-08 19:53:42paul.mooresetmessageid: <1578513222.27.0.424708782807.issue39255@roundup.psfhosted.org>
2020-01-08 19:53:42paul.moorelinkissue39255 messages
2020-01-08 19:53:42paul.moorecreate