[mod_python] connection to host server broken

Graham Dumpleton graham.dumpleton at gmail.com
Mon Mar 26 17:09:58 EST 2007

On 26/03/07, sikander hayat <hayat221 at yahoo.com> wrote:
> Hi,
> I am using suse 10.1, Apache 2.2.4, python 2.5 and mod_python 3.3.1.
> The error log is as follows:
> [Mon Mar 26 10:16:48 2007] [warn] RSA server certificate is a CA certificate
> (BasicConstraints: CA == TRUE !?)
> [Mon Mar 26 10:16:48 2007] [warn] RSA server certificate CommonName (CN)
> `localhost' does NOT match server name!?
> [Mon Mar 26 10:16:48 2007] [notice] mod_python: Creating 8 session mutexes
> based on 256 max processes and 0 max threads.
> [Mon Mar 26 10:16:48 2007] [notice] mod_python: using mutex_directory /tmp
> [Mon Mar 26 10:16:48 2007] [notice] Apache/2.2.4 (Unix) DAV/2 mod_ssl/2.2.4
> OpenSSL/0.9.8d mod_python/3.3.1 Python/2.5 PHP/5.2.1
> mod_apreq2-20051231/2.5.7 m
> od_perl/2.0.2 Perl/v5.8.7 configured -- resuming normal operations
> [Mon Mar 26 10:17:04 2007] [error] [client] File does not
> exist: /opt/lampp/htdocs/favicon.ico
> [Mon Mar 26 10:17:35 2007] [notice] mod_python (pid=3230,
> interpreter='localhost'): Importing module
> '/opt/lampp/htdocs/parkweb/index.py'
> [Mon Mar 26 10:17:35 2007] [notice] mod_python (pid=3231,
> interpreter='localhost'): Importing module
> '/opt/lampp/htdocs/parkweb/index.py'
> [Mon Mar 26 10:17:36 2007] [notice] child pid 3230 exit signal Segmentation
> fault (11)
> [Mon Mar 26 10:17:36 2007] [notice] child pid 3231 exit signal Segmentation
> fault (11)
> I have recently upgraded to python 2.5. So, to say, i have 2 versions of
> python on my system. Will try to remove the older one and try again.

To confirm whether that is necessary, set:

  PythonHandler mod_python.testhandler

In the output from that just verify that the sys.path information is
correct for the version of Python you expect to use. From the above
log entries there probably isn't a problem with versions as mod_python
will actually log some warnings if it finds a different version of
Python than what it was compiled with and that isn't in the log

> ****Why is it loading the module twice ...is that normal ???

Note how the 'pid' is different for each. This means that there were
two requests and that they so happened to be handled by different
Apache child processes.

> Kindly let me know if something rings a bell.

Since you are using Python 2.5, it should not be the expat version
problem as Python 2.5 is supposed to change things to avoid that one.
I would though still suspect that it is some versioning problem with
shared libraries. For example, if your web application uses some sort
of database and you also have PHP loaded and it is using some
different version of the database client library. This sort of
mismatch can cause a crash as one library will take precedence over
the other and if they are not compatible it can crash.

What you may need to do is start adding debug into your code and the
framework it uses such that you output a log message before and after
every module import. For example:

  from mod_python import apache

  apache.log_error(__file__  + " #1")
  import pyexpat
  apache.log_error(__file__ + " #2")
  import module2
  apache.log_error(__file__ + " #3")

See how many of the messages come out in the Apache error log and slow
narrow it down to a specific module being importer causing the crash.

If the module imports aren't the problem but something in handler
itself, do something similar, logging messages to the Apache log until
you find exactly what call causes it.


> Thanks,
> Graham Dumpleton <graham.dumpleton at gmail.com> wrote:
>  On 24/03/07, Jim Gallacher wrote:
> > sikander hayat wrote:
> > > Hi all,
> > >
> > > My apache webserver on linux recently broke down, so i reinstalled it,
> along with mod_python. Having made the necessary changes in the conf file of
> apache, i tried some of the simple tests, such as mptest, but i keep on
> getting the following error.
> > >
> > > Connection to host server ... lost.
> > >
> > > Why is that, is it because of python or some apache setting.
> >
> > Or network problems?
> >
> > What do you find in your apache logs?
> The Apache error log would be a good start, as it looks to me like
> your Apache child processes are crashing. You may find errors about
> segmentation violations or similar in the logs. If you do, check that
> the version of mod_python you are using is the correct one for the
> version of Python and Apache you are using. Having multiple versions
> of Python installed can also cause issues.
> BTW, are you using precompiled packages or compiling everything from
> source code? What operating system are you using?
> Graham
>  ________________________________
> Sucker-punch spam with award-winning protection.
>  Try the free Yahoo! Mail Beta.

More information about the Mod_python mailing list