canonical / canonical/testflinger

[Bug] traceback when using CTRL-C to exit a polling session

Open
#1,150 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
26
Forks
49
Avg merge
4d 8h
Merged PRs (30d)
16

Description

Was polling a job (`testflinger poll 0507fccf-b62a-48c0-b180-412d084f86f5`)

When I used ctrl-c to exit the polling session instead of a clean exit I got multiple tracebacks:

```
2026-06-15 14:44:33,718 rockman INFO: DEVICE CONNECTOR: MAAS: 22 minutes passed since deployment.
2026-06-15 14:45:35,438 rockman INFO: DEVICE CONNECTOR: MAAS: 23 minutes passed since deployment.
2026-06-15 14:46:37,125 rockman INFO: DEVICE CONNECTOR: MAAS: 24 minutes passed since deployment.
2026-06-15 14:47:38,770 rockman INFO: DEVICE CONNECTOR: MAAS: 25 minutes passed since deployment.
2026-06-15 14:48:40,621 rockman INFO: DEVICE CONNECTOR: MAAS: 26 minutes passed since deployment.
2026-06-15 14:49:42,342 rockman INFO: DEVICE CONNECTOR: MAAS: 27 minutes passed since deployment.
2026-06-15 14:50:44,026 rockman INFO: DEVICE CONNECTOR: MAAS: 28 minutes passed since deployment.
^C
Traceback (most recent call last):
File "/snap/testflinger-cli/266/lib/python3.10/site-packages/testflinger_cli/__init__.py", line 115, in cli
tfcli.run()
File "/snap/testflinger-cli/266/lib/python3.10/site-packages/testflinger_cli/__init__.py", line 171, in run
self.args.func()
File "/snap/testflinger-cli/266/lib/python3.10/site-packages/testflinger_cli/__init__.py", line 1546, in poll_output
self.poll(LogType.STANDARD_OUTPUT)
File "/snap/testflinger-cli/266/lib/python3.10/site-packages/testflinger_cli/__init__.py", line 1517, in poll
self.do_poll(job_id, log_type)
File "/snap/testflinger-cli/266/lib/python3.10/site-packages/testflinger_cli/__init__.py", line 1689, in do_poll
time.sleep(10)
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/snap/testflinger-cli/266/lib/python3.10/site-packages/testflinger_cli/__init__.py", line 117, in cli
sys.exit("Received KeyboardInterrupt")
SystemExit: Received KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/snap/testflinger-cli/266/bin/testflinger-cli", line 12, in
sys.exit(cli())
File "/snap/testflinger-cli/266/lib/python3.10/site-packages/testflinger_cli/__init__.py", line 121, in cli
StatusLine.stop()
File "/snap/testflinger-cli/266/lib/python3.10/site-packages/testflinger_cli/status_line.py", line 84, in stop
sys.stdout.flush()
BrokenPipeError: [Errno 32] Broken pipe
Exception ignored in: <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
Command exited with non-zero status 120
32:15.80
```

Contributor guide

Open the contributing guide

Research direction

Start in testflinger_cli/__init__.py at cli, poll_output, poll, and do_poll, then inspect status_line.py at StatusLine.stop. Reproduce a Ctrl-C during a polling session and trace the shutdown path. Done means interrupting the poll exits without the multiple tracebacks and BrokenPipeError shown in the report.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.