halt apache startup on exception?

5 views
Skip to first unread message

Ron Rothman

unread,
Jan 4, 2012, 7:58:43 PM1/4/12
to mod...@googlegroups.com
Greetings,

Is there a way to have mod_wsgi halt apache startup if the WSGIImportScript throws an exception?

The background:  We've been using mod_wsgi for several years, much to our satisfaction.  It's currently servicing hundreds of millions of requests per day for us.  Years ago, we modified the then-current version of mod_wsgi (I think it was v2.3) so that it aborted apache's startup (we're in embedded mode) if any initialization failed.  We require this for robustness; if an application config or some init data is bad--which we've seen happen from time to time--then we don't want the server to start.  We prefer that it fail loudly and obnoxiously so that there's no chance to miss the error.

We're embarking on a new project, and we'd like to use an updated version of mod_wsgi--but we don't want to re-do our code modifications if we don't have to.  Do newer versions of mod_wsgi support halting on init error?  I've perused the docs and haven't found any such feature; hoping to have better luck asking here.

Thanks for a great piece of software, and for any help you can provide.
- ron

Graham Dumpleton

unread,
Jan 4, 2012, 8:26:03 PM1/4/12
to mod...@googlegroups.com
There is no specific feature like that and this is the first time
anyone has asked about something like that.

I would be interested to hear what changes you have made, as I am not
sure how you would halt the whole of Apache.

This is because the WSGIImportScript is only done in the forked Apache
child server process or daemon process and not the parent process.
Thus there isn't really a way to cause the parent process to fail as
that code execution doesn't happen in the parent process.

Further, that code execution happens more than once. That is, in all
child server and daemon processes separately. What do you do if one
one out of many processes fails for some reason?

Overall startup failure like that isn't an easy problem to solve. I
have been trying with my New Relic performance monitoring work to come
up with a way of tracking those preloading imports, both for
timing/performance and errors, but that in itself is tricky. This is
because they happen so early that the New Relic agent wouldn't even
have registered and got its configuration at that point. So, you don't
have the configuration to know what you need to collect.

Either way, I am trying to make mod_wsgi more friendly to monitoring
and also improving configuration ability so can be tuned better based
on monitoring being done, so as I said, interested to know what the
changes are that you made.

Graham

> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/5pOc-UGtSnAJ.
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to
> modwsgi+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/modwsgi?hl=en.

Reply all
Reply to author
Forward
0 new messages