Skip to content

TCP port 50051 remains in use after unclean IDE exit #654

Open

Description

Describe the bug
Arduino-ide can leave behind something listening on port 50051 if the gui exits uncleanly

...
daemon INFO Restarting daemon in 5 seconds...
daemon INFO Failed to listen on TCP port: 50051. Address already in use.
daemon INFO Daemon exited with exit code: 5.
daemon INFO Restarting daemon in 4 seconds...
daemon INFO Restarting daemon in 3 seconds...
daemon INFO Restarting daemon in 2 seconds...
daemon INFO Restarting daemon in 1 seconds...
daemon INFO Restarting daemon now...
daemon INFO Starting daemon from /home/opt/arduino-ide_2.0.0-rc1_Linux_64bit/resources/app/node_modules/arduino-ide-extension/build/arduino-cli...
daemon INFO Using config file: /home/ckuethe/.arduinoIDE/arduino-cli.yaml
daemon INFO arduino-cli version 0.20.1
daemon INFO Executing `arduino-cli daemon`
daemon INFO Setting up Prometheus metrics on :9090/metrics
daemon INFO Starting daemon on TCP address 127.0.0.1:50051
daemon ERROR listen tcp :9090: bind: address already in use
daemon ERROR Failed to listen on TCP port: 50051. Address already in use.
daemon INFO Failed to start the daemon.
daemon ERROR Error: Failed to listen on TCP port. Address already in use.
    at Function.parse (/home/opt/arduino-ide_2.0.0-rc1_Linux_64bit/resources/app/node_modules/arduino-ide-extension/lib/node/arduino-daemon-impl.js:244:24)
    at Socket.<anonymous> (/home/opt/arduino-ide_2.0.0-rc1_Linux_64bit/resources/app/node_modules/arduino-ide-extension/lib/node/arduino-daemon-impl.js:143:43)
    at Socket.emit (events.js:223:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:181:23)
...

To Reproduce
Steps to reproduce the behavior:

  1. in a terminal /path/to/arduino-ide 2>&1 | tee /tmp/arduino-log-1
  2. get annoyed at how long startup takes
  3. kill the process with^C
  4. /path/to/arduino-ide 2>&1 | tee /tmp/arduino-log-2
  5. observe the listen failure

Expected behavior
Either clean up all processes on the way out, or try to reuse existing arduino-cli process

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Ubuntu x86_64
  • Version: 21.04LTS
  • Desktop: XFCE4
  • Arduino: 2.0.0-rc1

Additional context
Add any other context about the problem here.

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

Metadata

Assignees

Labels

topic: CLIRelated to Arduino CLItopic: 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