google / google/openhtf

Keyboard interrupt: double `Ctrl-C` too quickly hangs the library

Open
#1,259 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
722
Forks
237
Avg merge
11h 31m
Merged PRs (30d)
4

Description

If a user attempts to terminate the program a second time with `ctrl-c`, the interrupt handlers deadlock.
Output logs with `-v`:
```
I 11:38:54 station_server - Starting station server at:
Local: http://localhost:4444
Remote: http://TAURUS:4444
I 11:38:54 test_descriptor - Executing test:
Enter a DUT ID in order to start the test.
^CE 11:38:56 test_descriptor - Received SIGINT, stopping all tests.
E 11:38:56 test_descriptor - Aborting due to SIGINT
E 11:38:56 test_descriptor - Test state:
E 11:38:56 test_executor - Abort test executor.
^CE 11:38:56 test_descriptor - Received SIGINT, stopping all tests.
^CE 11:39:47 test_descriptor - Received SIGINT, stopping all tests.
^CE 11:39:47 test_descriptor - Received SIGINT, stopping all tests.
^CE 11:39:47 test_descriptor - Received SIGINT, stopping all tests.
^CE 11:39:47 test_descriptor - Received SIGINT, stopping all tests
```
Backtrace from the python debugger:
Image

The nested handler is waiting forever on the test lock, which was already taken by the original handler:
Image

I suspect this would be solved with internal state that checks whether `handle_sig_int` is already running.

If this does happen, the only way I have found to terminate the program is via the `kill` command.

openhtf version: v1.6.1
OS: Ubuntu 24.04, under WSL2

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.