Exim love apache

same here, happens on apache 2. this is a directadmin issue because this does not happen on other servers with the software. Only on the da servers. So something with the da setup of this is wrong and causing problems.

I think this needs to be recognized as an offical bug
 
same here, happens on apache 2. this is a directadmin issue because this does not happen on other servers with the software. Only on the da servers. So something with the da setup of this is wrong and causing problems.

I think this needs to be recognized as an offical bug

This is not just a DA problem, if you look Here you will see another non-DA user with this problem.

Perhaps it has something to do with a php bug, since that is what would normally be calling sendmail (exim).

If for some reason the fork'd and exec'd /usr/(sbin|lib)/sendmail process didn't exit, and the apache/php process that did the fork didn't close all open file descriptors that didn't have the close-on-exec flag set(which apache doesn't do), then I can see this happening. The exim process would still be around and have all the same files/ports open that the parent apache/php process had.
 
Hi,

We have the same problem on our DirectAdmin servers! running Debian Sarge and Ubuntu Dapper.

The systems run:
- Debian Sarge or Ubuntu Dapper
- Apache 2.0.59
- PHP 5.2.1
- MySQL 5.0.24
- Exim 4.63

I was able to reproduce this once when a customer was sending a mass mailing from his website, this caused the load to raise to a level wich was to high and i decided to give Apache a restart.

I did: /etc/init.d/httpd restart

When Apache said it couldn't start i checked the error_log and saw: Unable to bind to 0.0.0.0:80

A quick "netstat -nap" reveiled that Exim was listening on port 80.

When i killed exim Apache was able to start again.

So this problem seems to come up when Apache has a open file descriptor to /usr/sbin/sendmail (exim) and it gets restarted, Exim then takes over the sockets of Apache and is binded to port 80.

We switched to Ubuntu Dapper for our new servers hoping that this problem would not occur on this servers, but it does. (Also because of this)

I created the following cronjob that runs every minute, it isn't that nice, but it works for now.
Code:
#!/bin/sh

NUM=`netstat -nap --inet|grep ":80"|grep LISTEN|grep exim|wc -l`

if test ! $NUM = "0"; then
        killall -9 exim
        sleep 5
        /etc/init.d/exim start
        /etc/init.d/httpd start
fi

Is there a solution for this issue?
 
Just change apache_ver to 2.0 in options.conf and it will build apache 2.0 for you.
 
Ok, but what should be the big difference here?

It will still be Apache 2.0.59 wich i am currently running.

I modified my Apache compiling rules to my needs, so i don't see what the beta build should do different?
 
Because of the configure command etc., it's quite different. P.S. maybe you have strace results? Maybe the problem isn't in apache..
 
I use my own configure command, suited to my needs.

No sorry, i have no strace. Do you want a strace of Apache or Exim?
 
It would be great to have them both, do that when apache stops working. Thank you.
 
Ok, i'll try to re-create the problem and make a strace of both Apache and Exim.
 
Or a better way to do lsof:
Code:
netstat -nap --inet | grep 80 | grep LISTEN

There you should see exim with pid, do:
Code:
lsof -p [b]123456[/b]

Replace 123456 with the PID of exim.
 
I guess it has something with /etc/exim.pl, but we will see after lsof.
 
Hello,

I've found one spot in the exim.pl that was not closing an open file. I'm not sure if perl would have taken care of this for us, but I've fixed it anyway.
Fixed /etc/exim.pl is here... let me know if that does or does not change anything.

http://files.directadmin.com/services/exim.pl

To get it:
Code:
wget -O /etc/exim.pl http://files.directadmin.com/services/exim.pl

I changed this
Code:
sub get_domain_owner
{
	my ($domain) = @_;
	my $username="";
	open(DOMAINOWNERS,"/etc/virtual/domainowners");
	while (<DOMAINOWNERS>)
	{
		$_ =~ s/\n//;
		my ($dmn,$usr) = split(/: /, $_);
		if ($dmn eq $domain)
		{
			return $usr;
		}
	}
	close(DOMAINOWNERS);

	return -1;
}
to this
Code:
sub get_domain_owner
{
	my ($domain) = @_;
	my $username="";
	open(DOMAINOWNERS,"/etc/virtual/domainowners");
	while (<DOMAINOWNERS>)
	{
		$_ =~ s/\n//;
		my ($dmn,$usr) = split(/: /, $_);
		if ($dmn eq $domain)
		{
			[b]close(DOMAINOWNERS);[/b]
			return $usr;
		}
	}
	close(DOMAINOWNERS);

	return -1;
}
An open filedescriptor would be highly suspicious as a possible cause.

John
 
It seems that it fixes the problem, I'm still testing, but 24h problem hasn't appeared.
 
No, it doesn't solve the problem.

Code:
[root customapache]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
                                                           [FAILED]

Exim accesses .bytes files and it's the problem.
 
The apache /var/log/httpd/domains/domain.com.bytes or the /etc/virtual/usage/username.bytes? Assuming exim is on the apache bytes.

I'm wondering is putting a wrapper on /usr/sbin/sendmail would do the trick.. adding one more level of separation between the 2.

Create sendmail.new
Code:
#!/usr/bin/perl
 use Env;
 my $sm = '/usr/sbin/sendmail.orig';
 foreach  (@ARGV) {
         $arg="$arg" . " $_";
 }
 open (MAIL,"|$sm $arg") || die "cannot open $sm: $\n";
 while (<STDIN> ) {
         print MAIL;
 }
 close (MAIL);
Save, exit. Type:
Code:
mv sendmail sendmail.orig
mv sendmail.new sendmail
chmod 755 sendmail
or something like that. Note untested... but basics should work.

John
 
Back
Top