pyinvoke / invoke

Pythonic task management & command execution.
http://pyinvoke.org
BSD 2-Clause "Simplified" License
4.32k stars 365 forks source link

Looks like the timeout option does not work on all platform/python version combinaisons #851

Open tristanlatr opened 2 years ago

tristanlatr commented 2 years ago

Hello,

I'm opening this issue because I'm running into a weird issue that I can't reproduce on my local computer but does happen inside github runners on specific platform / python version combinaison.

Namely, ubuntu-20.04 with python 3.7 or 3.9. Note that my tests passes on python 3.8 and python 3.6 (wtf).

I've code this little module that wraps invoke: https://github.com/tristanlatr/security-scans-wrapper/blob/main/scans_wrapper/process.py

And you can see the failing test here test_ping_localhost_timedout(). The test only ensure that nothing got printed out because the process got killed after zero seconds.

Tell me what you think,

Here's a screenshot of test builds status

Capture d’écran, le 2022-03-29 à 11 37 03

Talk to you later

neozenith commented 2 years ago

Thanks for reporting. That sure is weird that it is 3.7 and 3.9, but not 3.6 and 3.8. Unfortunately we don't have the bandwidth to chase down issues that aren't reproducible.

Some suggestions:

That triage process to narrow it down, might help find the issue and you can resolve it yourself, or will put us in a better position to collaboratively triage further together.

tristanlatr commented 2 years ago

Hello @neozenith,

I’ll try to write a reproducible example with invoke only, and open a PR, so we can see the test fail in the CI.

tristanlatr commented 2 years ago

Hello @neozenith,

I think I'm in the right direction to give you more information about this bug. It looks like when we run a command like

ping -c 4 localhost

, everything happends normally regarding the timeout. But when the command is composed by multiple statements like:

mkdir -p /tmp/mydir
ping -c 4 localhost
echo 'Done'

The timeout option does not seem to work, meaning that the interrupt signal is not transmitted to the ping subprocess.

I'll wrap a test for this in a new test module since I'm completely lost in the fashion you designed your tests.

Talk to you later,

neozenith commented 2 years ago

Thanks for providing the PR. I'll continue discussion over on the PR.