Skip to content

arduino-cli does not clean up bossac after hang and control-c #3152

@atannen

Description

@atannen

Describe the problem

I have a flaky Arduino (a Feather M4-CAN), and sometimes my arduino-cli upload command hangs while sending the bytes from Linux to the device. arduino-cli is calling bossac to do the work. The problem is that if I control-c out of the hanging arduino-cli, it exits but the bossac is not killed in the background.

To reproduce

only when the sketch upload hangs (because of a flaky microprocessor, cable, etc....)

$ arduino-cli upload --fqbn adafruit:samd:adafruit_feather_m4_can --port /dev/ttyACM0 mysketch --input-dir /home/me/mysketch

Device       : ATSAME51x19
Version      : v1.1 [Arduino:XYZ] Mar 14 2024 20:18:07
Address      : 0x0
Pages        : 1024
Page Size    : 512 bytes
Total Size   : 512KB
Planes       : 1
Lock Regions : 32
Locked       : none
Security     : false
BOD          : false
BOR          : true
Write 79120 bytes to flash (155 pages)
[====================          ] 67% (104/155 pages)^C
real	0m35.886s
user	0m0.644s
sys	0m0.311s

$ ps -ef|grep ard

me         9889       1 94 14:01 pts/0    00:00:34 ~/.arduino15/packages/adafruit/tools/bossac/1.8.0-48-gb176eee/bossac --port=ttyACM0 -U -i --offset=0x4000 -w -v .../ardbin/sketch/mysketch.ino.bin -R

oddly, if I control-c out of a good upload in progress (while the equal-signs are printing), the bossac seems to exit properly

Expected behavior

when I control-c out, I expect the child bossac to exit, even if the arduino-cli was hung.

Arduino CLI version

arduino-cli Version: nightly-20260407 Commit: da1d3eb Date: 2026-04-07T01:42:08Z

Operating system

Linux

Operating system version

Linux 6.17.0-20-generic

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions