8000 Redundant discovery processes created by additional daemon instances · Issue #1981 · arduino/arduino-cli · GitHub
[go: up one dir, main page]

Skip to content
Redundant discovery processes created by additional daemon instances #1981
Open
@per1234

Description

@per1234

Describe the problem

Pluggable discovery tools supply Arduino CLI with a list of "ports" of connected Arduino boards. When Arduino CLI is running as a daemon, these tools are started when a gRPC request is received that requires a port listing and then left running for the remainder of the session.

🐛 Redundant processes for each discovery tool are created by additional instances of the Arduino CLI daemon. It is possible that discovery tools may not be designed to operate correctly in this way, and the multiple processes might interfere with each other.

To reproduce

Setup

$ arduino-cli version

arduino-cli  Version: 0.29.0-rc.1 Commit: 76251df9 Date: 2022-11-17T03:35:12Z

$ arduino-cli daemon

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 'serial-discovery'  # Discovery tools have not yet been started

$ 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.BoardList

[...]

$ pgrep -a -f 'serial-discovery'  # A process for each discovery tool was created

134825 /home/per/.arduino15/packages/builtin/tools/serial-discovery/1.3.2/serial-discovery

$ 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": 2
  }
}

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

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

[...]

$ pgrep -a -f 'serial-discovery'

134825 /home/per/.arduino15/packages/builtin/tools/serial-discovery/1.3.2/serial-discovery
135007 /home/per/.arduino15/packages/builtin/tools/serial-discovery/1.3.2/serial-discovery

🐛 A new process is created for each discovery tool by additional Arduino CLI daemon instances.

Expected behavior

A single instance of each discovery tool should be shared by all Arduino CLI daemon instances.

Arduino CLI version

76251df

Operating system

Windows, Ubuntu

Operating system version

Windows 10, Ubuntu 20.04

Additional context

Related: #1960

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

Labels

status: waiting for informationMore information must be provided before work can proceedtopic: 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

    0