Summary:ASTERISK-06858: unresponsive DNS servers cause asterisk to pause for extended periods during startup
Reporter:evilbunny (evilbunny)Labels:
Date Opened:2006-04-27 10:34:26Date Closed:2011-06-07 14:07:46
Versions:Frequency of
Description:due to network outage one of the register/peers in my sip.conf name servers weren't able to be reached, so asterisk locked half started up waiting for a DNS reply.... which is bad m'kay...

I'd suggest the quick fix is handle dns lookups etc after asterisk has fully loaded, or run them in parallel...
Comments:By: Andrey S Pankov (casper) 2006-04-27 11:11:07

Are you sure it is paused in main asterisk, not in a channel driver?

By: Andrey S Pankov (casper) 2006-04-27 11:17:45

As a workaround you may use /etc/hosts if it's configured to be used first...

By: evilbunny (evilbunny) 2006-04-27 17:51:07

I'm not sure where it paused, but it was only half done loading asterisk, while changing to IPs, or setting the host is a work around, are you planning to tell every asterisk user this or perhaps the problem should be fixed instead :)

By: Andrey S Pankov (casper) 2006-04-27 18:29:29

There even were places in the code with "can block for a long period of time"
because of gethostbyname. That's normal I think... Can you imagine the
configuration of static peers without IP address. How can we know you have
troubles with your DNS resolver until a name fails to resolve?

Any ideas?

By: evilbunny (evilbunny) 2006-04-27 18:32:29

All the error messages afterwards about unable to lookup sort of gives the fact away that something is wrong...

Alternatively perhaps the easier fix is a hard timeout of 5 seconds on dns lookups... While it will still lock on startup, it should be minimal compared to the minute or 2 per hostname now...

By: Serge Vecher (serge-v) 2006-05-08 12:58:21

evilbunny: still need to know what channel drivers are in use here ...

By: Andrey S Pankov (casper) 2006-05-08 13:14:56

Let's close this for now. It is a support issue.
One need to have a reliably working DNS server.
This does not require any changes to the Asterisk code.

By: Serge Vecher (serge-v) 2006-05-08 13:22:49

well, we need not wait up to 2 mins per hostname at startup either. IMHO, evilbunny's suggestion of making dns timeout an option in the channel driver or elsewhere has merit.

By: Andrey S Pankov (casper) 2006-05-08 14:10:06

vechers: and I stress on it again, this is a support issue.
'man 5 resolv.conf' or http://www.google.com/search?q=resolv.conf

Now I wondering who will send me $50 for that... :(

By: evilbunny (evilbunny) 2006-05-08 20:42:40

I think you misunderstand, it's not my DNS servers that were unreachable, it was the VSPs due to them having a network outage...

By: Olle Johansson (oej) 2006-05-09 10:13:17

This is a known problem on the "to-fix" list together with evilbunny's other enum problem. It's not a quick fix at all and, as I said, well known.

By: Joshua C. Colp (jcolp) 2006-05-19 09:24:13

I'm moving this to SVN trunk since in order to fix it, we'd have to do some MAJOR changes that I doubt would make it back to 1.2. Now - as others have said, this IS a very known about issue... and one of the ways to solve it outside of Asterisk that does work is to use something like dnsmasq which is a caching DNS proxy.

By: Russell Bryant (russell) 2006-05-19 09:31:55

The other question at hand is that is this really something that we should try to handle inside of Asterisk?  Should Asterisk really be expected to work normally in a broken network situation?  My vote is no ...

By: Joshua C. Colp (jcolp) 2006-05-19 11:49:07

Let's move future discussion of this to the asterisk-dev mailing list. See you there, everyone!