Skip to content

Fix runtime errors#742

Closed
rotu wants to merge 1 commit intoros-infrastructure:masterfrom
rotu:pr-1
Closed

Fix runtime errors#742
rotu wants to merge 1 commit intoros-infrastructure:masterfrom
rotu:pr-1

Conversation

@rotu
Copy link
Copy Markdown

@rotu rotu commented Mar 5, 2020

macOS 10.15
CPython 3.8.2 (installed with pyenv)
pyenv 1.2.16
pip 20.0.2

$ rosdep install --from src -ry

ERROR: Rosdep experienced an error: 
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
Please go to the rosdep page [1] and file a bug report with the stack trace below.
[1] : http://www.ros.org/wiki/rosdep

rosdep version: 0.18.0

Traceback (most recent call last):
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/rosdep2/main.py", line 144, in rosdep_main
    exit_code = _rosdep_main(args)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/rosdep2/main.py", line 428, in _rosdep_main
   
ERROR: Rosdep experienced an error: 
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
Please go to the rosdep page [1] and file a bug report with the stack trace below.
[1] : http://www.ros.org/wiki/rosdep

rosdep version: 0.18.0

Traceback (most recent call last):
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/rosdep2/main.py", line 144, in rosdep_main
    exit_code = _rosdep_main(args)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/rosdep2/main.py", line 428, in _rosdep_main
    return _package_args_handler(command, parser, options, args)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/rosdep2/main.py", line 483, in _package_args_handler
    pkgs = find_catkin_packages_in(path, options.verbose)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/rosdep2/catkin_packages.py", line 33, in find_catkin_packages_in
    packages = find_packages(path)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/catkin_pkg/packages.py", line 89, in find_packages
    packages = find_packages_allowing_duplicates(basepath, exclude_paths=exclude_paths, exclude_subspaces=exclude_subspaces, warnings=warnings)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/catkin_pkg/packages.py", line 139, in find_packages_allowing_duplicates
    pool = multiprocessing.Pool()
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/context.py", line 119, in Pool
    return Pool(processes, initializer, initargs, maxtasksperchild,
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/pool.py", line 212, in __init__
    self._repopulate_pool()
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/pool.py", line 303, in _repopulate_pool
    return self._repopulate_pool_static(self._ctx, self.Process,
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/pool.py", line 326, in _repopulate_pool_static
    w.start()
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/context.py", line 283, in _Popen
    return Popen(process_obj)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 42, in _launch
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/spawn.py", line 134, in _check_not_importing_main
    raise RuntimeError('''

macOS 10.15
CPython 3.8.2 (installed with pyenv)
pyenv 1.2.16
pip 20.0.2

```
$ rosdep install --from src -ry

ERROR: Rosdep experienced an error: 
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
Please go to the rosdep page [1] and file a bug report with the stack trace below.
[1] : http://www.ros.org/wiki/rosdep

rosdep version: 0.18.0

Traceback (most recent call last):
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/rosdep2/main.py", line 144, in rosdep_main
    exit_code = _rosdep_main(args)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/rosdep2/main.py", line 428, in _rosdep_main
   
ERROR: Rosdep experienced an error: 
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
Please go to the rosdep page [1] and file a bug report with the stack trace below.
[1] : http://www.ros.org/wiki/rosdep

rosdep version: 0.18.0

Traceback (most recent call last):
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/rosdep2/main.py", line 144, in rosdep_main
    exit_code = _rosdep_main(args)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/rosdep2/main.py", line 428, in _rosdep_main
    return _package_args_handler(command, parser, options, args)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/rosdep2/main.py", line 483, in _package_args_handler
    pkgs = find_catkin_packages_in(path, options.verbose)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/rosdep2/catkin_packages.py", line 33, in find_catkin_packages_in
    packages = find_packages(path)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/catkin_pkg/packages.py", line 89, in find_packages
    packages = find_packages_allowing_duplicates(basepath, exclude_paths=exclude_paths, exclude_subspaces=exclude_subspaces, warnings=warnings)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/catkin_pkg/packages.py", line 139, in find_packages_allowing_duplicates
    pool = multiprocessing.Pool()
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/context.py", line 119, in Pool
    return Pool(processes, initializer, initargs, maxtasksperchild,
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/pool.py", line 212, in __init__
    self._repopulate_pool()
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/pool.py", line 303, in _repopulate_pool
    return self._repopulate_pool_static(self._ctx, self.Process,
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/pool.py", line 326, in _repopulate_pool_static
    w.start()
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/context.py", line 283, in _Popen
    return Popen(process_obj)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 42, in _launch
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/multiprocessing/spawn.py", line 134, in _check_not_importing_main
    raise RuntimeError('''
```
@rotu
Copy link
Copy Markdown
Author

rotu commented Mar 5, 2020

Not sure what the status of rosdep-source is (still supported?), but it may make sense to instead migrate the code to src/rosdep2 and use a console script entry point there as well

Copy link
Copy Markdown
Member

@tfoote tfoote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep things to one change per commit. There's a more complete implementation of the entrypoint already submitted in #656 and that's not a "runtime error" Fixing the runtime issue is separable.

Related to that the error that you're getting appears to state that there's a problem with using multiprocessing and or forking. Neither of which I believe rosdep is doing itself. Which makes me think that this is not the appropriate solution but the protection for this issue should be done in the package catkin_pkg that's actually using multiprocessing.

  File "/Users/dan/.pyenv/versions/3.8.2/lib/python3.8/site-packages/catkin_pkg/packages.py", line 139, in find_packages_allowing_duplicates
    pool = multiprocessing.Pool()

@rotu
Copy link
Copy Markdown
Author

rotu commented Mar 18, 2020

@tfoote, you mean a PR that's been submitted over a year ago? What's the hold-up?

And yes it is a runtime error - see stack trace. I assumed that taking the entry point out of the library would prevent this issue.

The correct way to fix this, according to that error message, is to call freeze as soon as possible at the entry point. But it's a moot point if/when #656 is merged in, which I think totally resolves this issue.

@rotu
Copy link
Copy Markdown
Author

rotu commented Mar 18, 2020

Closing in preference to #656, which also slays these same runtime errors.

@rotu rotu closed this Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants