Re: getaddrinfo() starts failing with EAI_AGAIN (again)
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=jamus.com; s=dkim; t=1215693420; bh=FWqf6AhGxQrcQn5J4SN+k9eAVMWooFqkdGZBMEoa/yc=; h=Cc:Message-Id:From:To:In-Reply-To:Content-Type: Content-Transfer-Encoding:Mime-Version:Subject:Date:References; b=H+ER6Pb6/66DE57k/38JKkeOxxO8CxSS67ZhA3TPm6Q+7sKPJl+X7hDWjn6vgBpma suFxZ8urH6UprJWqKKHtYcfTuHeE6dALeMwySLpLNE+4TGYg7eci4ORHUPQASGtWwfo p9MKQM8loPPq3RYq7LJZwt53WY2pyctsnLOMops= Domainkey-signature: a=rsa-sha1; s=dk; d=jamus.com; c=simple; q=dns; h=cc:message-id:from:to:in-reply-to:content-type: content-transfer-encoding:mime-version:subject:date:references:x-mailer; b=s7nnhXJtiqOC+v4FayXnqoHMFOKhM2tmHaKI22gikE1/ASMLg01DCYrHkc/dCRIY9 5k4OQBLhBy9znueynM13A== On Jul 9, 2008, at 10:21 PM, Terry Lambert wrote: #!/bin/bash whoami >> /tmp/debug.log date >> /tmp/debug.log dig $1 >> /tmp/debug.log ping -c 5 $1>> /tmp/debug.log Jamus _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... On Jul 7, 2008, at 8:41 AM, Jamus Jegier wrote: A couple months ago, there was a post by Peter Oberauer about getaddrinfo() failing with EAI_AGAIN by processes under a specific process tree. I am running into the exact same problem, and was wondering if there was any resolution to the issue. I installed Nagios, which frequently forks processes to verify the status of network hosts. After about 8 hours, all child processes start failing with EAI_AGAIN. Under the Nagios parent process, dig works, but ping doesn't. Both DNS and Bonjour lookups begin to fail. Ping and the Nagios helper executables work fine when started under an unrelated process. The only other thing I can add is that I see this on 10.5.3 on a G4 system. I'm installing 10.5.4 now, and will post if I still see this. Typically, getaddrinfo() fails with EAI_AGAIN when there is a failure of malloc of the memory needed to return the linked list of addrinfo structures. This generally happens if: (1) you have a memory leak (either you fail to call freeaddrinfo() on the returned memory, or have a different leak) (2) you have fragmented your process address space (sufficiently that it is impossible to allocate a contiguous memory chunk large enough to return the requested information_ (3) the information you are requesting would be so large that it's impossible to return it (misconfigured DNS server, DNS cache poisoning attack, broken DNS server software, etc.) You should examine how much memory is in use by your process to distinguish #1, you should use vmmap to distinguish #2, and you should use host and similar commands and/or a packet analyzer (or tcpdump) to distinguish #3. Thanks for the suggestions, but I believe Peter Oberauer hit the nail on the head - starting the process from launchd solved my issues. Before that nagios was started by sshing into my system and sudo to the nagios user like this: sudo -u nagios /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/ nagios.cfg Nagios would run this script every few minutes successfully before it would start failing after approximately 8-10 hours. In this script, ping would fail while dig would succeed in resolving the domain name. So I don't think it would be #2, seeing that I doubt that ping would allocate and fragment its address space like you suggested. Also, I don't think it's #3, since bonjour also fails with a directly connected Airport Extreme, dig returns a good value with DNS queries, and pings outside of the nagios process tree would succeed I also don't think it's #1, since I would have noticed ping thrashing as it tried to allocate 4gb in my 1.5 gb system. I can attempt to reproduce the issue and try to gather hard data if my observations aren't sufficient. This email sent to site_archiver@lists.apple.com
participants (1)
-
Jamus Jegier