RedHat 8.0 Apache + Python CGI segmentation faults

Steve Holden sholden at holdenweb.com
Sun Feb 23 22:58:14 EST 2003


"Bengt Richter" <bokr at oz.net> wrote ...
[...]
> >It's a great list, but most of it isn't likely to apply - this error even
> >occurs with the following CGI:
> >
> >#!/usr/bin/python
> >print """Content-Type: text/html
> >
> ><html>
> ><head><title>Test Page</title></head>
> ><body>
> ><h2>Hello!</h2>
> ></body>
> ></html>
> >"""
> >
> Try executing this as cgi (don't forget to chmod) by looking with
> your browser at
>
>     http://<yoursite>/cgi-bin/trypy
>
> or wherever you put it
>
> ====< trypy >================
> #!/bin/sh
> #
> echo Content-type: text/plain
> echo
> which python  2>&1
> which ldd  2>&1
> python -uv <<EOF 2>&1
> print '--- This is a test ---'
> EOF
> echo --- back in sh ---
> echo $PATH
> which python | xargs ldd
> =============================
>
> And compare with what you get running this script directly (as user
apache?)
> where your python script "worked."
>
>
> >That being the case, I'm force to conclude it's something in the server -
> Maybe get the results of the above before concluding conclusively?
>
Hmm. Well, your script is now permanently installed as "bengt.py" in
gratitude for your efforts to help me solve this problem. Very useful. As we
suspect, there's an exact match between the outputs under both
circumstances.

> >the httpd.conf file is pretty standard, and I have the code running on
other
> >Apache installations both under Windows and Linux. I did find an Apache
bug
> >report [14692] that looked kind of relevant, so I'm compiling the upgrade
as
> >I write. [aarrgghh! I need an updated mod_auth_mysql, and I can't even
find
> >where it's required!].
> >
> >Anyway, the main point of this reply is to let you know that RH8.0
doesn't
> >use Python 1.5.2 any more, as far as I can see from a superficial look.
The
> >/usr/bin/python binary is 2.2.1, which is about as up-to-date as a
release
> >process can be, and shouldn't produce compatibility problems with an
upgrade
> >to 2.2.2.
> Famous last words ;-)
>
Well OK, I might live to regret them, but Python does better than VB, for
example, at maintaining compatibility.

> >
> >I recently had email from Todd Warner at Red Hat: apparently developers
will
> >be attending PyCon, and they want to talk about the recent developments
in
> >their use of Python. Although there's nothing formally scheduled, I think
> >this will be a primary candidate for use of the Open Space that we have
left
> >for at-conference scheduled presentations.
> >
> >Thanks for your input: it could easily have been one of the possible
> >problems you mentioned!
> >
> You're welcome. Hope the little script tells you more.
>

In actual fact the whole episode horrifyingly mirrors the situation when I
started using Apache2 under Windows. Once again I finally tracked the
problem down to this simple issue: if a directory's ,htaccess file contains
SetEnv directives, any access to that directory will cause a segmentation
fault.

The reason I didn't record it in the Apache bug dtabase the first time
around is because I followed their advice to upgrade to the latest version
first, and 2.0.43 doesn't exhibit that problem.

Of course, RedHat haven't yet got any RPM more recent than 2.0.20 available.
Building Apache 2.0.44 from scratch with the default settings caused
problems with module version incompatibilities against the existing
installation's configuration. Compiling a completely-dynamic version with
totally different prefix directories, however, confirms that the bug does
indeed go away, and I'm happy to say the site is now behaving correctly.

Should I file a bug report with Red Hat?

Thanks for your persistence on this one.

regards
--
Steve Holden                                  http://www.holdenweb.com/
Python Web Programming                 http://pydish.holdenweb.com/pwp/
Register for PyCon now!            http://www.python.org/pycon/reg.html







More information about the Python-list mailing list