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

cloudflared returning zero exit code on error #96

cblecker opened this issue May 7, 2019 · 2 comments


2 participants
Copy link

commented May 7, 2019

If cloudflared starts up before networking and DNS resolution is up and running, it will throw an error and exit. However, this error is returning a zero/success exit code.. as such launchd on Darwin sees that the application intended to exit, and doesn't restart it.

$ cloudflared
INFO[0000] Build info: {GoOS:darwin GoVersion:go1.11.1 GoArch:amd64} 
INFO[0000] Version 2019.4.1                             
INFO[0000] Flags                                proxy-dns-upstream="," url="ssh://"
INFO[0000] cloudflared will not automatically update when run from the shell. To enable auto-updates, run cloudflared as a service: 
INFO[0000] Starting metrics server                       addr=""
INFO[0000] Proxying tunnel requests to 
ERRO[0000] Error looking up Cloudflare edge IPs: the DNS query failed: lookup on [::1]:53: read udp [::1]:52309->[::1]:53: read: connection refused 
ERRO[0000] Please try the following things to diagnose this issue: 
ERRO[0000]   1. ensure that is returning "warp" service records. 
ERRO[0000]      Run your system's equivalent of: dig srv 
ERRO[0000]   2. ensure that your DNS resolver is not returning compressed SRV records. 
ERRO[0000]      See GitHub issue 
ERRO[0000]      For example, you could use Cloudflare's as your resolver: 
INFO[0000] ResolveEdgeIPs err                           
ERRO[0000] Quitting due to error                         error="Could not lookup srv records on lookup on [::1]:53: read udp [::1]:52309->[::1]:53: read: connection refused"
INFO[0000] Metrics server stopped                       
$ echo $?

If instead this reported a non-zero exit code, launchd would see that the process failed and it should attempt to restart it.


This comment has been minimized.

Copy link

commented May 7, 2019

Potential fixes:

  • sticking within the context of the cli framework, we can have the "Could not lookup srv records" error (and other errors) implement
  • or we could fix it at a level "beneath" the cli framework by checking all the errors ourselves and exiting accordingly.

@cblecker cblecker referenced a pull request that will close this issue May 15, 2019


Handle exit code on err #99


This comment has been minimized.

Copy link

commented May 15, 2019

I believe #99 should fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.