-
Notifications
You must be signed in to change notification settings - Fork 55
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
TypeError: an integer is required (got type NoneType) in pebble/pool/process.py", line 178, in message_manager_loop #58
Comments
Simple reproducer: #!/usr/bin/env python3
from pebble import ProcessPool
from concurrent.futures import wait, FIRST_COMPLETED
def run():
pass
while True:
with ProcessPool(max_workers=16) as pool:
print('new ProcessPool')
futures = []
for i in range(10):
futures.append(pool.schedule(run))
wait(futures, return_when=FIRST_COMPLETED)
pool.close()
pool.stop()
pool.join()
|
Hello,
Yet, it should not fail as such. Thank for providing a minimum reproducible example. I will fix this ASAP. |
Thank you for the quick answer. You probably mean #!/usr/bin/env python3
from pebble import ProcessPool
from concurrent.futures import wait, FIRST_COMPLETED
import os
def run(foo):
return foo
while True:
with ProcessPool(max_workers=16) as pool:
print('new ProcessPool')
futures = []
for i in range(10):
futures.append(pool.schedule(run))
wait(futures, return_when=FIRST_COMPLETED)
pool.stop()
pool.join() $ ./pe.py
new ProcessPool
Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib64/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib64/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3.8/site-packages/pebble/pool/process.py", line 178, in message_manager_loop
pool_manager.process_next_message(SLEEP_UNIT)
File "/usr/lib/python3.8/site-packages/pebble/pool/process.py", line 210, in process_next_message
message = self.worker_manager.receive(timeout)
File "/usr/lib/python3.8/site-packages/pebble/pool/process.py", line 342, in receive
return self.pool_channel.recv()
File "/usr/lib/python3.8/site-packages/pebble/pool/channel.py", line 63, in recv
return self.reader.recv()
File "/usr/lib64/python3.8/multiprocessing/connection.py", line 250, in recv
buf = self._recv_bytes()
File "/usr/lib64/python3.8/multiprocessing/connection.py", line 421, in _recv_bytes
return self._recv(size)
File "/usr/lib64/python3.8/multiprocessing/connection.py", line 379, in _recv
chunk = read(handle, remaining)
TypeError: an integer is required (got type NoneType)
new ProcessPool
new ProcessPool
new ProcessPool
new ProcessPool
new ProcessPool
new ProcessPool
new ProcessPool
new ProcessPool
new ProcessPool
new ProcessPool
... Thanks. |
I just tried your examples with Python 3.8 and could not reproduce it. Also, the Pool stopping routine is tested via Travis. If there would be some issue, it would have already shown up. What OS are you using? |
I'm using
Note that I've just tested that on 3 different And I also tested
|
Make pytest run with -s in order to print output.
Make pytest run with -s in order to print output.
Make pytest run with -s in order to print output.
As explained in the pull request, one needs |
@hroncok Can you please test in on a bare-metal Fedora system? |
What test exactly? And with what pebble (from RPM, from PyPI or from git master)? |
The test mentioned in #58 (comment). |
I don't know.
|
Thank you @hroncok. You see exactly the same problem as I do. |
Managed to reproduce it on one of my environments. I will investigate further, thanks for reporting this. |
@noxdafox Any update on this please? |
I'm seeing this on FreeBSD too. Any update? |
When terminating the Pool, there might be situations in which the results polling thread still tries to received data from a closed pipe. This leads to the thread crashing with a visible traceback on the logs. I could not reproduce this in older versions of Python. I could not figure out what changed in Python 3.8 but as it is a race condition type of issue it might be very difficult to debug. Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
Good job 👍 |
I've just rebuilt openSUSE package and the issue is gone. |
Can you please merge my PR #61 that tests this issue? |
Issue fixed in release |
First, I would like to really thank for the library. I need to create a process pool where I need capability to immediately terminate running tasks. I can't understand why the official
concurrent.futures
lacks the ability.However, I see various exceptions when I do
pool.stop()
:https://github.com/marxin/creduce/blob/threadpool/creduce/utils/testing.py#L317-L319
Can you please help me what can I do wrong?
The text was updated successfully, but these errors were encountered: