Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Previous custom discovery tool process left running after update #1960

Closed
3 tasks done
per1234 opened this issue Nov 2, 2022 · 0 comments · Fixed by #2062
Closed
3 tasks done

Previous custom discovery tool process left running after update #1960

per1234 opened this issue Nov 2, 2022 · 0 comments · Fixed by #2062
Assignees
Labels
priority: high Resolution is a high priority topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Nov 2, 2022

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
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Nov 2, 2022
@cmaglie cmaglie added the priority: high Resolution is a high priority label Nov 16, 2022
@cmaglie cmaglie added this to the Arduino CLI 1.0 milestone Jan 31, 2023
@Bikappa Bikappa self-assigned this Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high Resolution is a high priority topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants