Exim love apache

I had the problem on a brand new server just minutes ago....

I use zabbix for all my servers. I just made an trigger/action that when httpd is down on a DA server Zabbix executes this:

{HOSTNAME}:service exim stop
{HOSTNAME}:killall exim
{HOSTNAME}:service httpd start
{HOSTNAME}:service exim start

I tested it and it works like a charm....
 
Last edited:
Do you restart exim? Or do you let DirectAdmin restart it after a minute?

I suppose you could also make a change to the startup file for httpd so it'll automatically stop exim first, and restart it after httpd is started.

Jeff
 
Sorry, I did not copied the last line:
{HOSTNAME}:service exim start

So yes, I do start exim also.

Changing the startup file for httpd is an option but than you stop exim allways and zabbix is doing this only when there is an problem anyway.

But without zabbix I definitly would change the startup script yes.
 
I'm wondering what the community concensus is, since I've never had the problem. I hope more users will post and make their thoughts known.

Jeff
 
This link was posted before and explains everything in detail: http://bugs.php.net/bug.php?id=38915
I'm not going to write a complete shorter version, mostly because they are still discussing about it, but here is a stripped version:

- the module version of PHP (any version) for Apache, mod_php, doesn't use a couple of special functions provided by Apache (any version) to execute properly any program
- PHP developers feel like Apache should do it internally instead of asking the module developers to use them
- exim is written to be a fast and lightweight program, therefore doesn't support too many "open files" (sockets or files being open by the program) and freezes if it happens
- when sending and email, Apache through mod_php launches "exim" in the wrong way, passing his open files handlers, and if you have a lot of domains therefore a lot of logs, or if you have a lot of clients connected, well you will have a lot of open files... and exim freezes
- being exim freezed, when Apache has to be restarted (for any reason), it ignores the SIGCHILD sent by his "httpd" parent process and stays alive, always attached to the same open files, from which there is also the TCP socket on port 80 and/or 443

Solutions are all stated within the bug report. There are only workarounds for the moment. I suggest using FastCGI.
 
I'm wondering what the community concensus is, since I've never had the problem. I hope more users will post and make their thoughts known.

Jeff

try to send mail from forum VB, IB,, etc after 15min or less apache down
only one way kill exim and restart apache and exim

Wael
 
Don't know why but it just happend again.

My zabbix server saved me! The httpd service was because of that only 30 seconds or so down...
 
I cant believe you like zabbix I think it is junky. I dont like their interface at all.

Zabbix, Groundwork, Zenoss are all just ripoffs of Nagios anyways.

I use Nagios myself and find it to do everything I need.
 
Well its not that I was promoting zabbix; it happens to be the tool where I made a solution for the problem here.

You can replace the name zabbix with any tool that can execute remote commands when a faillure occurs.

This is not the right place for the discussion about zabbix versus Nagios :D
 
Well I read 4 pages and no real solution.
I am having this problem every time I create new hosting acount.
apache can not start. But after one or two minutes it starts....
If I kill exim I can start faster.
 
Hello,

There has not been any official fixes from the php or exim people.. they both seem to blame each other. You could try using a graceful restart.. the catch is that it's not very well tested.
http://help.directadmin.com/item.php?id=181
If you try it, you'd have to keep a close eye on things, for new users, tallys, etc. If it works, let us know.

John
 
Hello,

There has not been any official fixes from the php or exim people.. they both seem to blame each other. You could try using a graceful restart.. the catch is that it's not very well tested.
http://help.directadmin.com/item.php?id=181
If you try it, you'd have to keep a close eye on things, for new users, tallys, etc. If it works, let us know.

John

Isn't it more foolproof to stop apache, stop exim and kill any remaining exim process. Then start everything?
 
For apache yes.. but you shouldn't have to. Plus that would end up killing any sends half-way through sending.. we wouldn't want that. From what I've been reading the issue is that when apache shuts down in the middle of an email send through exim, all httpd processes die, but because of the exec() call to exim, exim is the last child standing.. and likely isnt' getting the message or something with sockets not closing correctly.. so the last exim assumes control over all of the inherited ports from apache, ie: 80, 443.. (not exactly sure why, or how).. but when you telnet to port 80 after that, you get your standard exim headers. The graceful version of the apache restart would "in theory" work because the parent httpd process never really goes anywhere. It politely tells it's children to "exit when you can", and reads in the new configs. Any unused child processes get restarted immediately, but active ones can continue on their jobs until they're done with that one request (say sending an email through exim), and then die.. but because the main httpd parent process never actually went anywhere, it's still in control of the sockets. In any case, in theory it should work fine using graceful, I'm just unsure of the full restart requirements for ssl changes in virtualhosts and log reopenings. If apache doesn't like the graceful restart when a new user is added because of new ssl settings, then the whole thing won't work. (that's why we do restarts and not reloads, as I know reloads are not sufficient. Graceful is somewhere in the middle)

John
 
Question: does this problem go away if we use php as CGI instead of mod_php?

If so, is that a solution?

Suggestion: I don't really mind killing sends halfway through exim; the apache restarts don't really happen that often, and exim still simply restart sending as soon as it can. The receiving server should drop the partially received email as it's supposed to.

So what's the problem with shutting down exim if it'll solve the problem?

Jeff
 
Question: does this problem go away if we use php as CGI instead of mod_php?
Yes, it does.

If so, is that a solution?
I couldn't say it's a real solution, because PHP as CGI has some cons too, but it solves this problem :)

Suggestion: I don't really mind killing sends halfway through exim; the apache restarts don't really happen that often, and exim still simply restart sending as soon as it can. The receiving server should drop the partially received email as it's supposed to.

So what's the problem with shutting down exim if it'll solve the problem?

Jeff
Yes, it's another way to solve the problem, but.. do you think it's worth to add exim start/stop code into httpd start/stop script? (I don't)
 
I personally would rather have the issue fixed... but if you want it to work "for sure" and don't mind the extra few seconds of downtime for each apache restart, then it would be a viable solution.

John
 
Back
Top