question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

check hangs forever when parallel execution is on

See original GitHub issue

Hello. There is the following issue with parallel execution.

Suppose there are two files with unused imports:

test_parallel/test1.py

import sys

test_parallel/test2.py

import sys

When run a check executed in parallel (-j 0 by default), it detects the unused imports, but then it hangs forever. And it needs keyboard interrupt to exit:

$ autoflake test_parallel --check

test_parallel/test1.py: Unused imports/variables detected
test_parallel/test2.py: Unused imports/variables detected
^CProcess SpawnPoolWorker-10:
Process SpawnPoolWorker-9:
Process SpawnPoolWorker-8:
Process SpawnPoolWorker-6:
Process SpawnPoolWorker-5:
Process SpawnPoolWorker-4:
Process SpawnPoolWorker-2:
Process SpawnPoolWorker-1:
Traceback (most recent call last):

Once child process exits after errors found, the main process just sits there waiting for something to be returned from the child process. But child have already exited, so there is nothing to return resulting in a forever wait.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
fsouzacommented, Sep 1, 2022

Ok, the problem is that we’re calling sys.exit and that blocks the pool. #133 fixes it.

0reactions
fsouzacommented, Sep 1, 2022

I can repro with the following steps:

% mkdir test_parallel
% echo "import sys" > test_parallel/file1.py
% cp test_parallel/file{1,2}.py
% autoflake --check test_parallel/*
test_parallel/file2.py: Unused imports/variables detected
test_parallel/file1.py: Unused imports/variables detected
# hangs

Investigating it now, if I don’t succeed I’ll update with more info for others.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parallel Execution, Appium hangs on first command (after ...
The problem Working fine on one device, but hangs forever on the first command with two or more. Example commands that hang for...
Read more >
Parallel Test Execution hangs indefinitely for rspec
So my question is simple: Why is it hanging, how can I debug why its hanging, and how can I stop it from...
Read more >
Solved: Yarn applications hang foreever if run in parallel
Now we get the problem that if we run multiple applications in parallel all stop and no one finished. it looks as if...
Read more >
How to diagnose a hanging DataStage Parallel job on AIX or ...
Answer. Determine whether the parallel job is hung: If a job is hung, the DataStage Director shows that the job is running but...
Read more >
[JENKINS-27969] parallel([:]) hangs forever
After that it is not possible to abort it, not even by restart. The workaround in JENKINS-25550 did the trick. Parallel should not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found