Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 229635 - NTP-Client doesn't timeout properly if dns is down
Summary: NTP-Client doesn't timeout properly if dns is down
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-26 19:01 UTC by Nathan March
Modified: 2008-06-28 17:37 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan March 2008-06-26 19:01:56 UTC
Looking at this page: http://www.gentoo-portage.com/net-misc/ntp/ChangeLog#ptabs

09 Jan 2007; Mike Frysinger <vapier@gentoo.org> files/ntp-client.confd,
files/ntp-client.rc, ntp-4.2.2_p3.ebuild, ntp-4.2.2_p4.ebuild,
ntp-4.2.4.ebuild:
Cleanup ntp-client script by scrubbing the lame timeout code that never
really worked. NTP itself handles timeouts sanely now.

The problem is that NTP doesn't handle DNS timeouts very well due to network problems. With two ntp servers configured and the network connection broken, system startup will be delayed by a full 2 minutes.

I'm not sure what Mike meant by 'never really worked' seeing as I've replaced the code in my local init script and tested it and it seems to function as designed. Giving it a NTPCLIENT_TIMEOUT of 10 seconds, breaking the network connection and restarting the machine results in ntpdate being killed after 10 seconds as expected. The built in ntpdate timeout settings do not seem to apply to DNS lookups, only the actual NTP query itself.

Reproducible: Always

Steps to Reproduce:
1. Add 2 servers to your /etc/conf.d/ntp-client
2. Break your network
3. Reboot and watch with joy as your startup process now takes an extra 2 minutes




The original functioning init code:


	ebegin "Setting clock via the NTP client '${NTPCLIENT_CMD}'"
	${NTPCLIENT_CMD} ${NTPCLIENT_OPTS} >/dev/null &
	local pid=$!
	(sleep ${NTPCLIENT_TIMEOUT:-30}; kill -9 ${pid} >&/dev/null) &
	wait ${pid}
	eend $? "Failed to set clock"
Comment 1 SpanKY gentoo-dev 2008-06-28 17:37:47 UTC
configure dns timeouts in your resolv.conf.  see the man page for more information.