-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Execution hangs in module level map call when pool is built in a submodule and submodule is imported in module's __init__ #19
Comments
Pool
.
I'm not sure what the issue is… I've not seen this before. So here are some tests... |
This has an unpickable object (the generator), and it fails by throwing an error (e.g. doesn't hang). |
This is basically your code, all in a single file. It throws an error due to the generator, but doesn't hang. |
If set |
Now, replicating what you have, but in a reduced form…
where:
You can infer the package structure from the import. Running |
Going to the extreme case:
where:
Then So it has nothing to do with the class |
Now, going back to using a
where:
Then |
If I edit the class |
So… I think I might have the error behavior well understood, but I still have no idea what would be causing it. |
It might be related to this issue: uqfoundation/dill#128, or I think less likely to this issue: uqfoundation/dill#56. |
Turning on
This produces:
While adding the same
… and then hangs on the lookup of the |
Hmm… both the use of a function and a class method also fail as before.
|
Modifying to move the functions to pickle into the imported module makes a difference…
where:
Results are as follows: for 'bar`:
then hangs. for
then hangs. For
then hangs. |
So it appears that failure is when there's a failed lookup of a function. Maybe coincidentally, when I control-C'd the thing, the tracebacks ended with this:
Which seems relevant, but maybe it's coincidence. I'm need to keep digging, but it might just be that the lookup of the function is happening in the wrong place. |
First of all, thank you for this awesome feedback. I modified your trial13/trial12 test by moving the
Where
Surprisingly, it works:
|
Wow. Seriously??? I can only theorize why that works at this point... Does this let you workaround in your code? Knowing why the above works is probably important, and would enable me to figure out what would need to be changed and how -- but as long as there's a feasible workaround, then it's not as imperative to figure out. |
@matsjoyce: I know this isn't a |
I think I found the real underlying issue. I was using a structure like this for my tests:
And the Then I tried your modification to my files and it still didn't work for me. I realized, however, you'd probably used a blank Matter of fact, I all the tests succeed when the So that's the real thing to watch out for. Don't import the submodule with the |
I can't get it to hang 😟 I have |
That's right. Now if you have |
Works fine for me, except |
I'm on OS X and the execution hangs with blank |
Hmm… Above, I tested python |
OK, I got it to hang (yay!). It seems to freeze in the serialisation thread while in
As you can see, Thread-2 stops after after the call to |
OK, here is my setup. I'm running Python 3.5.1 under OS X 10.11.5.
where
As before First of all, as seen in the stderr it fails to find
My
|
The repeated section it just the polling loop waiting for something to happen, which doesn't. |
@grayfall: the one process is just polling the other, and waiting for results. A timeout could be added, so if the timeout is met, an error is thrown, but that is not the root issue. @matsjoyce: It seems that 2.7 fails in more cases than 3.5, and sometimes with different errors. In the case of
|
Revisiting this... it seems that in python 3.7+ (and on MacOS, and with current versions of To summarize:
while this succeeds:
With
and similarly for No idea why the position of the |
Suppose we've got a project:
In
pkg/lib/workers
we have:in
pkg/test/workers.py
in
test.py
When I run
test.py
I get:If I change the second line of code in
pkg/test/workers.py
fromprint(Test(max).method([[1,2,3], [1,2,3]]))
toprint(Test(lambda x: max(x)).method([[1,2,3], [1,2,3]]))
, I getAnd the process freezes. Nothing happens for hours. No errors, no messages.
P.S.
This is a stripped down version of my real project, where I use the pool of workers inside a bound method of an instance and pass an attribute to the pool as a function to use. I believe this example reproduces the exact same problem.
P.P.S.
I've also asked the question on Stack Overflow (link)
The text was updated successfully, but these errors were encountered: