dkron icon indicating copy to clipboard operation
dkron copied to clipboard

dkron doesn't fail on startup if server port is already in use

Open dch opened this issue 5 years ago • 0 comments

Describe the bug

If an existing service is already running on port 8080, then dkron appears to start successfully, but doesn't bind to network socket.

To Reproduce

  • start netcat or other app on port 8080
  • start dkron
$ nc -l 8080 &
$ sockstat -46lp 8080
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS      
dch      nc         95771 4  tcp4   *:8080                *:*

$ dkron agent --server --bootstrap-expect=1
INFO[0000] No valid config found: Applying default values.  error="Config File \"dkron\" Not Found in \"[/usr/local/etc/dkron /home/dch/.dkron /tmp/config]\""
INFO[2021-01-05T21:17:23Z] agent: Dkron agent starting                   node=wintermute.skunkwerks.at
INFO[2021-01-05T21:17:23Z] agent: joining: [] replay: true               node=wintermute.skunkwerks.at
INFO[2021-01-05T21:17:23Z] api: Running HTTP server                      address=":8080" node=wintermute.skunkwerks.at
INFO[2021-01-05T21:17:23Z] dkron: monitoring leadership                  node=wintermute.skunkwerks.at
INFO[2021-01-05T21:17:23Z] agent: Listen for events                      node=wintermute.skunkwerks.at
INFO[2021-01-05T21:17:24Z] agent: Received event                         event=member-update node=wintermute.skunkwerks.at
INFO[2021-01-05T21:17:24Z] dkron: cluster leadership acquired            node=wintermute.skunkwerks.at
INFO[2021-01-05T21:17:24Z] dkron: monitoring leadership                  node=wintermute.skunkwerks.at
INFO[2021-01-05T21:17:24Z] agent: Starting scheduler                     node=wintermute.skunkwerks.at

Expected behavior

  • dkron should either log an error, and retry to bind to port
  • or (better) log error and exit noisily

** Specifications:**

  • FreeBSD 13.0 amd64
  • dkron 3.0.8 (source build)

dch avatar Jan 05 '21 21:01 dch