Bug 21424

Summary: Blocking issue while regenerating aliases on 4.1-RELEASE
Product: Base System Reporter: Fernando Schapachnik <fpscha>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.1-RELEASE   
Hardware: Any   
OS: Any   

Description Fernando Schapachnik 2000-09-20 18:50:00 UTC
        First thing I noticed was that newaliases was getting hung.
Further investigation showed the problem was
~majordom/aliases.majordom.db

        Running makemap hash ~majordom/aliases.majordom <
~majordom/aliases.majordom hunged also.

        A fstat showed only sendmail has this file open, and for
reading only.

        A ktrace shows:
 [...]
 87185 makemap  CALL  open(0xbfbff658,0x622,0x1a4)
 87185 makemap  NAMI  "aliases.majordomo.db"
 [a lot of time... sent kill]
 87185 makemap  PSIG  SIGINT SIG_DFL

        aliases.majordom.db ends with 0 bytes. Removing the file
solves the problem.

        Sometimes same thing happens with virtusertable and similar
aliases-related files.

        Today the same happened with access.db. Lsof showed
sendmail 52975 root 7rR VREG 109,196608 0 35980 /etc/mail/access.db

        which means sendmail has the whole file locked for reading.

        Doing a ps -axl shows lockfs state and a sleeping process
(waiting for a lock, I guess).

Fix: 

Workaround: Remove the .db file and run newaliases/makemap
acordingly.

        To avoing concurrency problems, I'm using this script:

#!/bin/sh
dir=/usr/local/sendmail_aliases

# Copy actual alias file to fake dir.
cp /usr/local/majordomo/aliases.majordomo $dir/usr/local/majordomo/aliases.ma
jordomo
cp /etc/mail/alias-de-clientes $dir/etc/mail/alias-de-clientes
cp /etc/mail/aliases $dir/etc/mail/aliases
cp /etc/mail/usertable $dir/etc/mail/usertable

# Regenerate aliases inside the cage.
/usr/sbin/chroot $dir /usr/sbin/sendmail -bi
/usr/sbin/chroot $dir /usr/sbin/makemap hash /etc/mail/usertable < /etc/mail/
usertable

# Put aliases files in its proper place.
cp $dir/usr/local/majordomo/aliases.majordomo.db /usr/local/majordomo/aliases
.majordomo.db  
cp $dir/etc/mail/alias-de-clientes.db /etc/mail/alias-de-clientes.db
cp $dir/etc/mail/aliases.db /etc/mail/aliases.db
cp $dir/etc/mail/usertable.db /etc/mail/usertable.db
How-To-Repeat: 
  Run newaliases during busy hours.
Comment 1 iedowse freebsd_committer freebsd_triage 2001-08-26 11:52:20 UTC
State Changed
From-To: open->feedback


Does this problem still occur with newer releases?
Comment 2 Sheldon Hearn freebsd_committer freebsd_triage 2002-01-30 09:20:33 UTC
State Changed
From-To: feedback->closed

Automatic feedback timeout.  This PR remained unchanged in the feedback 
state for more than 4 months. 

If additional feedback that warrants the re-opening of this PR is 
available but not included in the audit trail, please include the 
feedback in a reply to this message (preserving the Subject line) and 
ask that the PR be re-opened.