Skip to content

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

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

Open
ckuethe opened this issue Dec 1, 2021 · 1 comment
Open

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

ckuethe opened this issue Dec 1, 2021 · 1 comment
Assignees
Labels
topic: CLI Related to Arduino CLI topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@ckuethe
Copy link

ckuethe commented Dec 1, 2021

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.

@ckuethe ckuethe added the type: imperfection Perceived defect in any part of project label Dec 1, 2021
@per1234
Copy link
Contributor

per1234 commented Dec 2, 2021

There is a related discussion at #201 about how the IDE or Arduino CLI can avoid or improve the user experience in the event of a port collision.

Even though related, this issue is not a duplicate of #201 because this issue is about the former use of the IDE itself being the cause of the collision rather than some expected collision with another application using 50051 (e.g., Multipass).

@per1234 per1234 changed the title Failed to listen on TCP port: 50051. Address already in use. TCP port 50051 remains in use after unclean IDE exit Dec 2, 2021
@per1234 per1234 added topic: CLI Related to Arduino CLI topic: code Related to content of the project itself labels Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: CLI Related to Arduino CLI topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants