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

Management port closure is not handled correctly #2407

Open
starlightcrafted opened this issue Nov 18, 2024 · 0 comments
Open

Management port closure is not handled correctly #2407

starlightcrafted opened this issue Nov 18, 2024 · 0 comments

Comments

@starlightcrafted
Copy link

starlightcrafted commented Nov 18, 2024

Before filing a Bug Report

Using these will ensure you get quicker support, and make this space available for code-related issues. Thank you!

  • Docs Site => Troubleshooting, quickstarts, and more advanced topics.
  • Discuss Forum => Our discussion forum for users and support to mutually resolve issues & suggest ideas.
  • Reddit => Our subreddit, which we monitor regularly and is fairly active.
  • Knowledge Base => Older wiki.

If you are having a connection issue, it's much easier to diagnose through the discussion forum or the ticket system.

If you still want to file a Bug Report

Please let us know

What you expect to be happening.

ZeroTier Client shuts down and management ports are cleared

What is actually happening?

ZeroTier Client does not seem to set SO_REUSEADDR, or there is something else not releasing the port, so the management port cannot be immediately reused if the management port receives HTTP calls right before restarting or if a HTTP client keeps the connection open while it is restarting.

On restart, the ZeroTier Client starts emitting the error /usr/sbin/zerotier-one: fatal error: cannot bind to local control interface port 9993 and fails to restart until the time defined at /proc/sys/net/ipv4/tcp_tw_recycle has passed.

Any steps to reproduce the error.

Run the below bash script in one window. Restart ZeroTier Client in another.

This is a simple script to simulate the ZeroTier Client restarting while a there is still a connection to the management port.

#!/bin/bash

while true
do
telnet localhost 9993
done

Using some debugging tools like ss you can now see there are left over TCP-WAIT connections.

ss state time-wait sport = 9993

Which can then be killed using

ss state time-wait sport = 9993 -K

A quick fix in case someone else experiences this is to just add the following to /etc/systemd/system/zerotier-one.service.d/kill.conf

[Service]
ExecStartPre=/usr/bin/ss state time-wait sport = 9993 -K

Any relevant console output or screenshots.

What operating system and ZeroTier version. Please try the latest ZeroTier release.

Ubuntu 24.04
ZeroTier 1.14.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant