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 Ellenbogen
Recipients Paul Ellenbogen
Date 2016-04-15.19:43:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1460749416.45.0.0472811645443.issue26773@psf.upfronthosting.co.za>
In-reply-to
Content
If a shelve is opened, then the processed forked, sometime the shelve will appear to work in the child, and other times it will throw a KeyError. I suspect the order of element access may trigger the issue. I have included a python script that will exhibit the error. It may need to be run a few times.

If shelve is not meant to be inherited by the child process in this way, it should consistently throw an error (probably not a KeyError) on any use, including the first. This way it can be caught in the child, and the shelve can potentially be reopened in the child.

A current workaround is to find all places where a process may fork, and reopen any shelves in the child process after the fork. This may work for most smaller scripts. This could become tedious in more complex applications that fork in multiple places and open shelves in multiple places.

-------------------------------------------------------

Running

#!/usr/bin/env python3

import multiprocessing
import platform
import sys

print(sys.version)
print(multiprocessing.cpu_count())
print(platform.platform())


outputs:
3.4.3+ (default, Oct 14 2015, 16:03:50) 
[GCC 5.2.1 20151010]
8
Linux-4.2.0-34-generic-x86_64-with-Ubuntu-15.10-wily
History
Date User Action Args
2016-04-15 19:43:36Paul Ellenbogensetrecipients: + Paul Ellenbogen
2016-04-15 19:43:36Paul Ellenbogensetmessageid: <1460749416.45.0.0472811645443.issue26773@psf.upfronthosting.co.za>
2016-04-15 19:43:36Paul Ellenbogenlinkissue26773 messages
2016-04-15 19:43:36Paul Ellenbogencreate