views:

102

answers:

2

I am hosting a Django app on Apache using mod_python. Occasionally, I get some cryptic mod_python errors, usually of the ImportError variety, although not usually referring to the same module. The thing is, these seem to come up for a single forked subprocess, while the others operate fine, even when I force behavior that requires using the module that the problem process has errored on. Once the process encounters the error, it will always just serve the same traceback every time Apache chooses it to handle a request. (This is also a hassle, since my users don't necessarily report the error on the first occurrence, and once the process encounters the error.)

I know more about configuring Django than configuring Apache, but that won't get me anywhere since the request never reaches Django for processing. Ideally, I should solve the root problem, and that might involve my code, project, or machine configuration, but until then, I need help diagnosing and mitigating the problem.

  1. Is there any way to configure the Apache logs to include a subprocess id?
  2. Is there any way to force a subprocess to respawn if it has hit an error?
  3. Are there any known issues relating to this that I should know about?
+1  A: 

As a workaround, and assuming you are free to install new Apache modules on the server, you might try one of

  • mod_scgi
  • mod_fastcgi
  • mod_wsgi

instead. I use SCGI to connect an nginx frontend webserver to my Django apps, which highlights a major benefit (decoupling from the webserver). All of these packages are available in Debian, probably on RHELx as well.

Eric Drechsel
Yes, that workaround really might be the path I take. I've heard that mod_fastcgi might be the way to go in general.
David Berger
A: 

A more detailed version of this question with accepted answer is available at this reposting:

http://stackoverflow.com/questions/970953/testing-for-mysterious-load-errors-in-python-django

David Berger