# Sendmail is hanging on new connections after updating various ports..



## osx-addict (Aug 30, 2009)

Ok.. I haven't updated any of the jail ports or the main ports for several months.  I was overdue for some security fixes and whatnot.. So, I started getting the latest versions of all s/w in the 3 jails I've got (1 for sendmail & friends, and two others for web stuff).  Anyway, I'm now finding that all incoming sendmail connections are getting stuck and leaving the connection open.  Below is a sample of some truss output from one of the stuck processes running in my mail jail :


```
setitimer(0,{0.000000, 0.000000 },0x0)		 = 0 (0x0)
gettimeofday({1251597125.497543 },0x0)		 = 0 (0x0)
getpid(0xbfbfa624,0x0,0x0,0x804a5f1,0x7aa84,0x2a4e) = 10830 (0x2a4e)
gettimeofday({1251597125.498238 },0x0)		 = 0 (0x0)
getpid(0xbfbfa624,0x0,0x0,0x804a5f1,0x7aa84,0x2a4e) = 10830 (0x2a4e)
setitimer(0,{0.000000, 0.000000 },0x0)		 = 0 (0x0)
gettimeofday({1251597125.499283 },0x0)		 = 0 (0x0)
sigreturn(0xbfbfa660,0xe,0x0,0xbfbfa660,0x0,0x80c5b10) ERR#4 'Interrupted system call'
stat("/etc/mail/aliases.db",{ mode=-rw-r----- ,inode=6526754,size=16384,blksize=4096 }) = 0 (0x0)
lstat("/",{ mode=drwxr-xr-x ,inode=6382592,size=512,blksize=4096 }) = 0 (0x0)
geteuid(0xbfbf1b3c,0xbfbf9f3c,0x8000,0x0,0x0,0x0) = 0 (0x0)
lstat("/etc",{ mode=drwxr-xr-x ,inode=6382596,size=2048,blksize=4096 }) = 0 (0x0)
geteuid(0xbfbf1b3c,0xbfbf9f3c,0x8000,0x0,0x0,0x0) = 0 (0x0)
lstat("/etc/mail",{ mode=drwxr-xr-x ,inode=6526500,size=1024,blksize=4096 }) = 0 (0x0)
geteuid(0xbfbf1b3c,0xbfbf9f3c,0x8000,0x0,0x0,0x0) = 0 (0x0)
stat("/etc/mail/aliases.db",{ mode=-rw-r----- ,inode=6526754,size=16384,blksize=4096 }) = 0 (0x0)
open("/etc/mail/aliases.db",O_SHLOCK,0640)	 = 10 (0xa)
fcntl(10,F_SETFD,FD_CLOEXEC)			 = 0 (0x0)
read(10,"\0\^F\^Ua\0\0\0\^B\0\0\^D\M-R\0"...,260) = 260 (0x104)
fstat(10,{ mode=-rw-r----- ,inode=6526754,size=16384,blksize=4096 }) = 0 (0x0)
flock(0xa,0x8,0x0,0x20,0x0,0x1000)		 = 0 (0x0)
fstat(10,{ mode=-rw-r----- ,inode=6526754,size=16384,blksize=4096 }) = 0 (0x0)
flock(0xa,0x1,0x23,0xf3f,0x2,0xbfbfa86b)	 = 0 (0x0)
fstat(10,{ mode=-rw-r----- ,inode=6526754,size=16384,blksize=4096 }) = 0 (0x0)
lseek(10,0x1000,SEEK_SET)			 = 4096 (0x1000)
read(10,""\0\M-{\^O\M-v\^O\M-k\^O\M-g\^O"...,4096) = 4096 (0x1000)
flock(0xa,0x8,0x23,0xf3f,0x2,0xbfbfa86b)	 = 0 (0x0)
gettimeofday({1251597125.507230 },0x0)		 = 0 (0x0)
close(10)					 = 0 (0x0)
gettimeofday({1251597125.507921 },0x0)		 = 0 (0x0)
sigprocmask(SIG_BLOCK,SIGALRM,0x0)		 = 0 (0x0)
gettimeofday({1251597125.508610 },0x0)		 = 0 (0x0)
getpid(0xbfbfa994,0x0,0x811381c,0x53,0x639722,0x181a0) = 10830 (0x2a4e)
sigaction(SIGALRM,{ 0x80c5b10 SA_RESTART ss_t },{ 0x80c5b10 SA_RESTART ss_t }) = 0 (0x0)
setitimer(0,{0.000000, 60.000000 },0x0)		 = 0 (0x0)
sigprocmask(SIG_UNBLOCK,SIGALRM,SIGALRM)	 = 0 (0x0)
sigprocmask(SIG_UNBLOCK,SIGALRM,0x0)		 = 0 (0x0)
gettimeofday({1251597125.510758 },0x0)		 = 0 (0x0)
sigprocmask(SIG_BLOCK,0x0,0x0)			 = 0 (0x0)
```

Below is what I see in /var/log/messages after killing some of the stuck sendmail processes after shutdown (using kill -9)..  Not sure if this helps or not..


```
Aug 28 21:05:11 smtp sm-mta[95798]: n7T37IjC039507: SYSERR(root): putbody: write error: Broken pipe
Aug 28 21:05:12 smtp sm-mta[95798]: n7T2Oioh036689: SYSERR(root): putbody: write error: Broken pipe
Aug 28 21:35:12 smtp sm-mta[32314]: n7T37IjC039507: SYSERR(root): putbody: write error: Broken pipe
Aug 28 21:35:12 smtp sm-mta[32314]: n7T2Oioh036689: SYSERR(root): putbody: write error: Broken pipe
```


At this point, I've rebuild from scratch sendmail from the latest ports but no obvious changes are noticeable.. Any ideas on how I can get the mail back up and running?


----------



## osx-addict (Aug 30, 2009)

*Solved!*

Ok.. After *beep**beep**beep**beep*ing around for several hours, it turns out to be a case of having the alias file outdated.  If was running but REALLY slow.. I finally saw some of the following message in the log file once in a while.. :


```
Aug 29 23:00:10 smtp sm-mta[17190]: alias database /etc/mail/aliases.db out of date
```

After issuing a "sendmail -bi" to update the aliases.db file (which apparently can't be updated using "makemap hash /etc/mail/aliases.db </etc/mail/aliases".. Something I didn't realize.  Once the above sendmail was done, it started cruising like crazy.. All problems disappeared!


----------



## DutchDaemon (Aug 30, 2009)

You can usually just run 'make' in /etc/mail to update all databases there.


----------



## osx-addict (Aug 31, 2009)

I was aware of that but it was under the impression that it was up-to-date and would do nothing..Oh well..


----------

