Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 249981 - net-dns/pdnsd - pdnsd-online init-script fails during bootup - cannot find pdnsd.status socket
Summary: net-dns/pdnsd - pdnsd-online init-script fails during bootup - cannot find pd...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Dialup Developers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-05 21:22 UTC by Lars Wendler (Polynomial-C) (RETIRED)
Modified: 2008-12-13 10:53 UTC (History)
0 users

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


Attachments
pdnsd.online.diff (pdnsd.online.diff,787 bytes, patch)
2008-12-05 21:27 UTC, Lars Wendler (Polynomial-C) (RETIRED)
Details | Diff
pdnsd.online.diff (pdnsd.online.diff,651 bytes, patch)
2008-12-11 21:28 UTC, Lars Wendler (Polynomial-C) (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2008-12-05 21:22:23 UTC
This happens during bootup of my machine:

 * Starting pdnsd ...                                                [ ok ]
 * Starting pdnsd-online ...
Error: could not open socket /var/cache/pdnsd/pdnsd.status: No such file or directory                                                            [ !! ]

It seems like pdnsd needs a short moment to create the socket so this is a typical race condition. In my case, the machine is an ancient 550 MHz Pentium-3. I didn't measure exactly but the socket file gets created about two seconds after /etc/init.d/pdnsd was started successfully and during these two seconds, /etc/init.d/pdnsd-online gets started and fails with the above mentioned error.

Reproducible: Always

Steps to Reproduce:




# emerge --info
Portage 2.1.6_rc2 (default/linux/x86/2008.0, gcc-4.1.2, glibc-2.6.1-r0, 2.6.25.20 i686)
=================================================================
System uname: Linux-2.6.25.20-i686-Pentium_III_-Coppermine-with-glibc2.0
Timestamp of tree: Thu, 04 Dec 2008 19:00:01 +0000
app-shells/bash:     3.2_p48
dev-lang/python:     2.5.2-r8
sys-apps/baselayout: 1.12.12
sys-apps/sandbox:    1.2.18.1-r3
sys-devel/autoconf:  2.63
sys-devel/automake:  1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="x86 ~x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium3 -mtune=pentium3 -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/opennap-ng"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/init.d /etc/revdep-rebuild /etc/ssl /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-march=pentium3 -mtune=pentium3 -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--alphabetical --jobs=1"
FEATURES="collision-protect distlocks parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo ftp://linux.rz.ruhr-uni-bochum.de/gentoo-mirror/ ftp://ftp.tu-clausthal.de/pub/linux/gentoo/ http://gentoo.oregonstate.edu http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LDFLAGS="-Wl,--as-needed"
MAKEOPTS="-j1 -s"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/layman/poly-c"
SYNC="rsync://192.168.0.254/gentoo-portage"
USE="acl acpi apache2 berkdb bzip2 cli cracklib crypt dri fam fastcgi gdbm gnutls iconv innodb ipv6 isdnlog libwww maildir midi mmx mudflap ncurses nls nptl nptlonly openmp pam pcre pppd readline reflection session slang snmp spl sse ssl sysfs unicode x86 xml xml2 xorg zlib" ELIBC="glibc" INPUT_DEVICES="keyboard" KERNEL="linux" USERLAND="GNU"
Unset:  CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2008-12-05 21:27:45 UTC
Created attachment 174356 [details, diff]
pdnsd.online.diff

How about this possible fix?
I introduced a new function wait_for_socket() which checks every second if the socket exists. I set the default timeout to ten seconds which should be enough even for very ancient systems.
Comment 2 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2008-12-05 21:35:25 UTC
whoops, chose wrong component.
Comment 3 Alin Năstac (RETIRED) gentoo-dev 2008-12-11 20:37:20 UTC
Your patch looks good, but it contains some bash-isms in it. Better solve this things, for the sake of portability:
  - don't use [[ ]], use simple brakets
  - "until" keyword doesn't seem to be present in the POSIX manual page of the sh command

my personal choice:
  for ((i=0; $i < 10; i=$i+1)); do
    [ -S ... ] && return 0
    sleep 1s
  done
Comment 4 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2008-12-11 21:28:13 UTC
Created attachment 175005 [details, diff]
pdnsd.online.diff

You are abolutely right. I completely forgot that bashisms are no longer a good decision when writing init-scripts which might be used with openrc...

How about this patch where I tried to incorporate your suggestions?
Comment 5 Alin Năstac (RETIRED) gentoo-dev 2008-12-13 10:53:46 UTC
Fixed in cvs. Thanks!