Package: wide-dhcpv6-server
Version: 20080615-1
Severity: grave
Justification: breaks upgrades

On startup, dhcp6s does not close any stray file descriptors it may have
inherited. When called from wide-dhcpv6-server.postinst, this includes
fd 3, which is a pipe to debconf. The result of this is a hang on
upgrade, with a process tree looking like this:

   1511 pts/8    Ss+    0:30                          \_ /usr/bin/dpkg 
--admindir=/var/lib/dpkg --status-fd 20 --configure libiw29 wireless-tools 
imagemagick libmagick++10 libplot2c2 libpstoedit0c2a ldap-utils li
  22001 pts/8    S+     0:04                              \_ /usr/bin/perl -w 
/usr/share/debconf/frontend /var/lib/dpkg/info/wide-dhcpv6-server.postinst 
configure 20061016-2
  22009 pts/8    Z+     0:00                                  \_ 
[wide-dhcpv6-ser] <defunct>
  22031 ?        Ss     0:00 /usr/sbin/dhcp6s -k /dev/null -P 
/var/run/dhcp6s.eth1.pid eth1

I can tell that the pipe to debconf is still open:

  $ sudo lsof -p 22001 | grep 'pipe$'
  frontend 22001 root    7w  FIFO    0,6         29433263 pipe
  frontend 22001 root    8r  FIFO    0,6         29433264 pipe
  $ sudo lsof -p 22031 | grep 'pipe$'
  dhcp6s  22031 root    3w  FIFO        0,6         29433264 pipe

wide-dhcpv6-server's postinst attempts to work around this problem by
calling db_stop to let debconf know that it's finished. However, it only
calls it if /etc/default/wide-dhcpv6-server does not exist, whereas it
sources the confmodule unconditionally (usually a good idea anyway since
sourcing the confmodule has weird semantics, re-execing the sourcing
script), so unless I'm much mistaken it seems that it will always fail
to upgrade.

Calling db_stop is at best an ugly workaround anyway. Rather than
calling db_stop, I would recommend that you make dhcp6s close all its
inherited file descriptors on startup. The usual idiom for this is
something like this (and no, as far as I know there is nothing neater):

  int fd;
  for (fd = 3; fd < 1024; ++fd)
    close(fd);

The daemon(0, 0) call that dhcp6s already makes will take care of file
descriptors 0, 1, and 2.

For anyone affected by this, a workaround to allow the upgrade to
proceed without inconvenient dpkg errors is to run
'/etc/init.d/wide-dhcpv6-server restart' from a separate shell.

Thanks,

-- 
Colin Watson                                       [cjwat...@debian.org]



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to