Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SystemError: Parent module 'multiprocessing' not loaded, cannot perform relative import #64832

Closed
AmrAli mannequin opened this issue Feb 15, 2014 · 3 comments
Closed
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@AmrAli
Copy link
Mannequin

AmrAli mannequin commented Feb 15, 2014

BPO 20633
Nosy @brettcannon

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2014-03-23.17:23:02.583>
created_at = <Date 2014-02-15.08:08:12.087>
labels = ['type-bug', 'library']
title = "SystemError: Parent module 'multiprocessing' not loaded, cannot perform relative import"
updated_at = <Date 2014-03-23.17:23:02.582>
user = 'https://bugs.python.org/AmrAli'

bugs.python.org fields:

activity = <Date 2014-03-23.17:23:02.582>
actor = 'sbt'
assignee = 'sbt'
closed = True
closed_date = <Date 2014-03-23.17:23:02.583>
closer = 'sbt'
components = ['Library (Lib)']
creation = <Date 2014-02-15.08:08:12.087>
creator = 'Amr.Ali'
dependencies = []
files = []
hgrepos = []
issue_num = 20633
keywords = []
message_count = 3.0
messages = ['211262', '211264', '214573']
nosy_count = 5.0
nosy_names = ['brett.cannon', 'jnoller', 'python-dev', 'sbt', 'Amr.Ali']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue20633'
versions = ['Python 3.3']

@AmrAli
Copy link
Mannequin Author

AmrAli mannequin commented Feb 15, 2014

Using multiprocessing.Manager to share a dict between two processes raises the below exception at main process termination. Child process is joined and terminates gracefully before the main process.

Replacing multiprocessing/forking.py:135 with from multiprocessing.connection import wait fixes the issue.

Python 3.3.1 (default, Sep 25 2013, 19:29:01) 
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version
'3.3.1 (default, Sep 25 2013, 19:29:01) \n[GCC 4.7.3]'

# multiprocessing/forking.py:135

132 def wait(self, timeout=None):
133 if self.returncode is None:
134 if timeout is not None:
135 from .connection import wait
136 if not wait([self.sentinel], timeout):
137 return None
138 # This shouldn't block if wait() returned successfully.
139 return self.poll(os.WNOHANG if timeout == 0.0 else 0)
140 return self.returncode

# Traceback

Traceback (most recent call last):
  File "/home/d4de/work/redacted/redacted-engine/venv/lib/python3.3/multiprocessing/util.py", line 255, in _run_finalizers
    finalizer()
  File "/home/d4de/work/redacted/redacted-engine/venv/lib/python3.3/multiprocessing/util.py", line 188, in __call__
    res = self._callback(*self._args, **self._kwargs)
  File "/home/d4de/work/redacted/redacted-engine/venv/lib/python3.3/multiprocessing/managers.py", line 588, in _finalize_manager
    process.join(timeout=1.0)
  File "/home/d4de/work/redacted/redacted-engine/venv/lib/python3.3/multiprocessing/process.py", line 127, in join
    res = self._popen.wait(timeout)
  File "/home/d4de/work/redacted/redacted-engine/venv/lib/python3.3/multiprocessing/forking.py", line 135, in wait
    from .connection import wait
SystemError: Parent module 'multiprocessing' not loaded, cannot perform relative import
Traceback (most recent call last):
  File "/home/d4de/work/redacted/redacted-engine/venv/lib/python3.3/multiprocessing/util.py", line 255, in _run_finalizers
    finalizer()
  File "/home/d4de/work/redacted/redacted-engine/venv/lib/python3.3/multiprocessing/util.py", line 188, in __call__
    res = self._callback(*self._args, **self._kwargs)
  File "/home/d4de/work/redacted/redacted-engine/venv/lib/python3.3/multiprocessing/managers.py", line 588, in _finalize_manager
    process.join(timeout=1.0)
  File "/home/d4de/work/redacted/redacted-engine/venv/lib/python3.3/multiprocessing/process.py", line 127, in join
    res = self._popen.wait(timeout)
  File "/home/d4de/work/redacted/redacted-engine/venv/lib/python3.3/multiprocessing/forking.py", line 135, in wait
    from .connection import wait
SystemError: Parent module 'multiprocessing' not loaded, cannot perform relative import

@AmrAli AmrAli mannequin added type-crash A hard crash of the interpreter, possibly with a core dump stdlib Python modules in the Lib dir labels Feb 15, 2014
@ezio-melotti ezio-melotti added type-bug An unexpected behavior, bug, or error and removed type-crash A hard crash of the interpreter, possibly with a core dump labels Feb 15, 2014
@AmrAli
Copy link
Mannequin Author

AmrAli mannequin commented Feb 15, 2014

Also importing multiprocessing.forking at the very beginning of MyLib/init.py fixes the problem.

@sbt sbt mannequin self-assigned this Mar 1, 2014
@python-dev
Copy link
Mannequin

python-dev mannequin commented Mar 23, 2014

New changeset 0b2814fc53ae by Richard Oudkerk in branch '3.3':
Issue bpo-20633: Replace relative import by absolute import.
http://hg.python.org/cpython/rev/0b2814fc53ae

@sbt sbt mannequin closed this as completed Mar 23, 2014
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant