Issues with multiprocessing module on Python 3.8
cehbrecht opened this issue · 2 comments
Description
There are issues with the Python multiprocessing
module on Python 3.8 when executing a process.
On the current master (v4.2.3) I get the following exception:
2020-01-10 16:17:20,375] [ERROR] line=45 module=exceptions Exception: code: 500, description: No applicable error code, please check error log., locator:
Traceback (most recent call last):
File "/Users/pingu/miniconda3/envs/emu/lib/python3.8/site-packages/pywps/app/Service.py", line 336, in call
raise e
File "/Users/pingu/miniconda3/envs/emu/lib/python3.8/site-packages/pywps/app/Service.py", line 326, in call
response = self.execute(
File "/Users/pingu/miniconda3/envs/emu/lib/python3.8/site-packages/pywps/app/Service.py", line 81, in execute
return self._parse_and_execute(process, wps_request, uuid)
File "/Users/pingu/miniconda3/envs/emu/lib/python3.8/site-packages/pywps/app/Service.py", line 169, in _parse_and_execute
wps_response = process.execute(wps_request, uuid)
File "/Users/pingu/miniconda3/envs/emu/lib/python3.8/site-packages/pywps/app/Process.py", line 140, in execute
wps_response = self._execute_process(self.async_, wps_request, wps_response)
File "/Users/pingu/miniconda3/envs/emu/lib/python3.8/site-packages/pywps/app/Process.py", line 184, in _execute_process
self._run_async(wps_request, wps_response)
File "/Users/pingu/miniconda3/envs/emu/lib/python3.8/site-packages/pywps/app/Process.py", line 213, in _run_async
process.start()
File "/Users/pingu/miniconda3/envs/emu/lib/python3.8/site-packages/pywps/processing/basic.py", line 36, in start
process.start()
File "/Users/pingu/miniconda3/envs/emu/lib/python3.8/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/Users/pingu/miniconda3/envs/emu/lib/python3.8/multiprocessing/context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "/Users/pingu/miniconda3/envs/emu/lib/python3.8/multiprocessing/context.py", line 283, in _Popen
return Popen(process_obj)
File "/Users/pingu/miniconda3/envs/emu/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 32, in __init__
super().__init__(process_obj)
File "/Users/pingu/miniconda3/envs/emu/lib/python3.8/multiprocessing/popen_fork.py", line 19, in __init__
self._launch(process_obj)
File "/Users/pingu/miniconda3/envs/emu/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 47, in _launch
reduction.dump(process_obj, fp)
File "/Users/pingu/miniconda3/envs/emu/lib/python3.8/multiprocessing/reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
TypeError: cannot pickle '_io.BufferedReader' object
Similar this happens also on the watchdog PR #505 with this exception:
line=45 module=queue PyWPS job queue failed: Can't pickle <function do_first at 0x1061484c0>: it's not the same object as jinja2.filters.do_first
Probably in this case it happens because WPSResponse
has a reference to a jinja template environment.
Environment
- operating system:
- Python version: 3.8
- PyWPS version: >=4.2.3
- source/distribution
- git clone
- Debian
- PyPI
- zip/tar.gz
- other (please specify):
- web server
- Apache/mod_wsgi
- CGI
- other (please specify):
Steps to Reproduce
Install Emu with Python 3.8 and run a process (hello, sleep).
Additional Information
I'm having the same issue - but with a simpler setup: a simple 'Greeter' WPS, that takes and returns simple String-primitives. No jinja involved. The issue occurs when attempting to execute a WPS in async mode.
Here is a repo to reproduce the issue:
repo
Environment
- python version: 3.6.9
- pywps version: 4.2.3
- OS: windows 10
- OS: windows 10
When it was introduced to PyWPS, multiprocessing
did not function on Windows. Therefore, it was never tested on that OS. Officially, PyWPS does not yet support Windows.