Skip to content

Previous custom discovery tool process left running after update #1960

Closed

Description

Describe the problem

In addition to the always available serial-discovery and mdns-discovery pluggable discovery tools of the builtin package, dependencies on custom discovery tools can be specified by boards platforms.

The latest version of the custom discovery dependency is installed when installing or updating that platform.

🐛 The process for the previous version of a custom discovery tool is left running after a boards platform update that updates the discovery tool.

To reproduce

Setup

$ arduino-cli version

arduino-cli  Version: git-snapshot Commit: 732bdc54 Date: 2022-09-07T09:00:01Z

$ export ARDUINO_DIRECTORIES_DATA="/tmp/arduino-cli-directories/data"

$ export ARDUINO_BOARD_MANAGER_ADDITIONAL_URLS="https://www.pjrc.com/teensy/package_teensy_index.json"

$ arduino-cli core update-index

$ arduino-cli core install teensy:avr@1.57.0  # Install outdated version of a platform with custom pluggable discovery tool dependency

[...]
Installing teensy:teensy-discovery@1.57.1...
teensy:teensy-discovery@1.57.1 installed
[...]

$ mv "${ARDUINO_DIRECTORIES_DATA}/packages/teensy/tools/teensy-discovery/1.57.1" "${ARDUINO_DIRECTORIES_DATA}/packages/teensy/tools/teensy-discovery/1.57.0"  # Simulate outdated discovery tool

$ arduino-cli daemon --debug

Daemon is now listening on 127.0.0.1:50051

Demo

run the following grpcurl commands in another terminal:

$ grpcurl \
  -plaintext \
  -import-path ./rpc \
  -proto cc/arduino/cli/commands/v1/commands.proto \
  127.0.0.1:50051 \
  cc.arduino.cli.commands.v1.ArduinoCoreService.Create

{
  "instance": {
    "id": 1
  }
}

$ grpcurl \
  -plaintext \
  -import-path ./rpc \
  -proto cc/arduino/cli/commands/v1/commands.proto \
  -d '{"instance": {"id": 1}}' \
  127.0.0.1:50051 \
  cc.arduino.cli.commands.v1.ArduinoCoreService.Init

$ pgrep -a -f 'teensy-discovery'

$ grpcurl \
  -plaintext \
  -import-path ./rpc \
  -proto cc/arduino/cli/commands/v1/commands.proto \
  -d '{"instance": {"id": 1}}' \
  127.0.0.1:50051 \
  cc.arduino.cli.commands.v1.ArduinoCoreService.BoardListWatch

[...]

$ pgrep -a -f 'teensy-discovery'

142276 /tmp/arduino-cli-directories/data/packages/teensy/tools/teensy-discovery/1.57.0/teensy-discovery

$ grpcurl \
  -plaintext \
  -import-path ./rpc \
  -proto cc/arduino/cli/commands/v1/commands.proto \
  -d '{"instance": {"id": 1}, "platform_package": "teensy", "architecture": "avr", "version": "1.57.1"}' \
  127.0.0.1:50051 \
  cc.arduino.cli.commands.v1.ArduinoCoreService.PlatformInstall

[...]

{
  "taskProgress": {
    "name": "Installing teensy:teensy-discovery@1.57.1"
  }
}

[...]

$ pgrep -a -f 'teensy-discovery'

142276 /tmp/arduino-cli-directories/data/packages/teensy/tools/teensy-discovery/1.57.0/teensy-discovery

$ grpcurl \
  -plaintext \
  -import-path ./rpc \
  -proto cc/arduino/cli/commands/v1/commands.proto \
  -d '{"instance": {"id": 1}}' \
  127.0.0.1:50051 \
  cc.arduino.cli.commands.v1.ArduinoCoreService.BoardListWatch

[...]

$ pgrep -a -f 'teensy-discovery'

142276 /tmp/arduino-cli-directories/data/packages/teensy/tools/teensy-discovery/1.57.0/teensy-discovery
142363 /tmp/arduino-cli-directories/data/packages/teensy/tools/teensy-discovery/1.57.1/teensy-discovery

🐛 There is a leftover teensy:teensy-discovery@1.57.0 process still running in addition to teensy:teensy-discovery@1.57.1.

Expected behavior

Discovery tool processes are cleaned up.

Arduino CLI version

732bdc5

Operating system

Windows, Ubuntu

Operating system version

Windows 10, Ubuntu 20.04

Additional context

Originally reported by @PaulStoffregen at https://forum.pjrc.com/threads/71370-Teensy4-1-reading-from-Serial-Monitor-of-Arduino-IDE?p=315184#post315184


I can also reproduce the issue using the equivalent command line interface commands. I chose to use the gRPC interface for the demo because the command line version seems unlikely to occur in real world usage, while the gRPC version is a simplification of an existing real world occurrence in Arduino IDE 2.x.


I suspected a similar problem might apply to the pluggable monitor tools (e.g., teensy-monitor). I did a quick check using Arduino IDE 2.x and found that only the previously running teensy-monitor process was running after the update. After I closed and reopened Serial Monitor, only a single teensy-monitor process for the updated version was running.

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

priority: highResolution is a high prioritytopic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions