Hang in subprocess.Popen()
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start by reading pyannotate_runtime/collect_types.py around the Queue.put() call referenced in the report, then inspect Python 2.7 POSIX subprocess.Popen() behavior at Popen._execute_child(). Try to reproduce the hang with tracing enabled and compare it with passing close_fds=True; done means establishing a reproducible failure and an agreed safe fix.
Written by the indexing model from the issue text.
Description
[UPDATE: If you have this problem, the solution is to pass close_fds=True to Popen()]
I've got a use case where a process being traced for type collection uses subprocess.Popen() to execute some helper program, and the Popen() call hangs at the line
data = _eintr_retry_call(os.read, errpipe_read, 1048576)
in Popen._execute_child(). (This is Python 2.7 on Mac, i.e. POSIX.)
That pipe has FD_CLOEXEC, so the child is not hitting the exec(). Presumably this is because it hangs in a Queue.put() operation in _trace_dispatch() (e.g. here).
I can think of a gross fix that monkey-patches os.fork to disable the profiling hook around the fork() so the child doesn't do this. But perhaps there's a more elegant solution (without using os.register_at_fork(), which is Python 3.7+ only)? Or the tracing hook could check the pid?
[UPDATE:] I can't repro this in a small test program. But it's real, and the os.fork monkey-patch fixes it. Not sure what to do about it yet, the monkey-patch seems risky.
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 59
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dropbox/pyannotate
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
dropbox/pyannotate#124 · 3 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
dropbox/pyannotate#123 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
dropbox/pyannotate#115 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
dropbox/pyannotate#109 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
dropbox/pyannotate#103 · 6 comments · 1 reaction ·
All issues in dropbox/pyannotate
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
conda-forge/conda-build-feedstock#289 · 1 comment · 1 reaction ·
-
`pulptest` no longer works in 4.0.0: `ImportError: Start directory is not importable: 'pulp/tests'`Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
remove reddit feedsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
TomCasavant/ohio-sites#224 ·