1

When running Trac on a server where mod_wsgi is configured in daemon road, Trac throws many errors of the form :"Premature end of script headers". I've looked into this, and it seems that there is a mismatch of versions of the expat library between Trac and Apache. Sadly, I am not in a position to rebuild Apache, which seems to be the only solution offered for this problem.

I'm wondering if any other solutions are possible. When I run in embedded mode, this problem disappears. Is it possible to configure a virtual host for Trac requests that runs in embedded mode, while other requests are handled by a host configured for daemon mode? We use daemon mode because of a Django project, so we don't have to restart the server when code is changed. But I don't know if setting thing up this way will solve the problem, or if such a setup is even possible.

SixDegrees
  • 781
  • 1
  • 8
  • 19

1 Answers1

0

Running in embedded mode isn't going to solve the problem. The message may go away but your Apache child process are likely still crashing, but that they are doing so may not be as obvious as main Apache error log would just be showing 'Segmentation fault' and little else.

When you say you looked into this, did you actually verify it as being the expat problem by running the tests documented on the mod_wsgi site?

I ask as expat issue is not the only reason why Trac may crash. Use of the Python wrappers for subversion in a sub interpreter can also cause problems. So, have you tried the documented workaround of setting:

WSGIApplicationGroup %{GLOBAL}

Have you gone as far as analysing with gdb where the code is crashing again as is documented on mod_wsgi wiki.

As for your question of whether Trac can run in embedded and your Django in daemon mode, yes it can be done, but from what I can see it likely isn't solving the problem.

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134
  • I haven't run the test programs yet; I can't do much during the day, when people are using the server, so that will have to wait until tomorrow. I did confirm that the version of expat used by Apache differs from that used by Python, significantly. I'm not at the machine right now, but Apache is using something like 1.5.x while Python is using 2.0.x. Oddly, we have been running Django in daemon mode through mod_wsgi for several months and have never seen this problem. It only appeared when we added Trac to the system. I have been running in embedded mode all morning without seeing any errors. – SixDegrees Aug 22 '11 at 15:57
  • Note that I will almost certainly not have time to explore this in a debugger. The errors, as already stated, all occur through Trac, and they are sporadic; refreshing the page normally clears the problem. But simply jettisoning Trac will likely be the preferred solution if a fix will require a lot of man hours. – SixDegrees Aug 22 '11 at 16:03
  • I ran your test apps from http://code.google.com/p/modwsgi/wiki/IssuesWithExpatLibrary; both examples, with and without expat, ran successfully, so apparently expat is off the hook as the culprit here. – SixDegrees Aug 23 '11 at 07:56
  • I ran your test apps from http://code.google.com/p/modwsgi/wiki/IssuesWithExpatLibrary; both examples, with and without expat, ran successfully, so apparently expat is off the hook as the culprit here. – SixDegrees Aug 23 '11 at 07:57
  • Other information: running django 1.2.5 and trac 0.12.2 with mod_wsgi 2.3 on apache 2.2.17 under Fedora 14. Not sure how to proceed here. As noted, the problem is sporadic and trac-related; our django application runs without errors, and even the trac application mostly runs; when errors occur, a page refresh normally clears them. Errors are never seen in embedded mode. Time, sadly, isn't going to be easy to come by given current office priorities, but I'll try to make time for any solutions offered. – SixDegrees Aug 23 '11 at 08:02
  • I can't see that you have said what you have WSGIApplicationGroup directive set to if at all. – Graham Dumpleton Aug 23 '11 at 10:34
  • WSGIApplicationGroup %{GLOBAL} – SixDegrees Aug 23 '11 at 14:52