Description

If some operation in our request code for mod_py fails, the exception is neither delivered to log nor to browser. Also connection disconnects might generate useless tracebacks.

The task is to check if this still happens with moin 1.6 and 1.7. If yes, catch exactly this error and ignore it. Make diffs with your changes.

This task is expected to take 12h. You have to complete it in 10 days.

Example

Fatal Python error: PyThreadState_Delete: tstate is still current
[Mon Dec 27 16:03:33 2004] [notice] child pid 24029 exit signal Abort trap (6)
[Mon Dec 27 16:03:33 2004] [error] [client 132.65.148.35] PythonHandler MoinMoin.request::RequestModPy.run: Traceback (most recent call last):
[Mon Dec 27 16:03:33 2004] [error] [client 132.65.148.35] PythonHandler MoinMoin.request::RequestModPy.run:   File "/usr/local/lib/python2.3/site-packages/mod_python/apache.py", line 299, in HandlerDispatch\n    result = object(req)
[Mon Dec 27 16:03:33 2004] [error] [client 132.65.148.35] PythonHandler MoinMoin.request::RequestModPy.run:   File "/usr/local/share/moin-1.3//lib/python2.3/site-packages/MoinMoin/request.py", line 1596, in run\n    return RequestBase.run(self)
[Mon Dec 27 16:03:33 2004] [error] [client 132.65.148.35] PythonHandler MoinMoin.request::RequestModPy.run:   File "/usr/local/share/moin-1.3//lib/python2.3/site-packages/MoinMoin/request.py", line 816, in run\n    self.write(u"\\n<!-- ERROR REPORT FOLLOWS -->\\n")
[Mon Dec 27 16:03:33 2004] [error] [client 132.65.148.35] PythonHandler MoinMoin.request::RequestModPy.run:   File "/usr/local/share/moin-1.3//lib/python2.3/site-packages/MoinMoin/request.py", line 1609, in write\n    self.mpyreq.write(self.encode(data))
[Mon Dec 27 16:03:33 2004] [error] [client 132.65.148.35] PythonHandler MoinMoin.request::RequestModPy.run: IOError: Write failed, client closed connection.
Fatal Python error: PyThreadState_Delete: tstate is still current
[Mon Dec 27 16:03:34 2004] [notice] child pid 24048 exit signal Abort trap (6)

Details

MoinMoin Version

1.3.1

Workaround

Discussion

The bug is not clear. please supply a way to reproduce this: server, versions, config, steps. Do you use "PythonDebug On" in your apache config? -- NirSoffer 2005-01-11 11:37:21

This looks like the client (read: browser) has closed the connection before all data was sent...

So it seems not to be an bug on the first look. -- OliverGraf 2005-01-18 06:51:34

More Information

I'm getting a similar error to this person. When I use ModPy, I get:

[Tue Jan 25 23:52:51 2005] [notice] Graceful restart requested, doing restart
[Tue Jan 25 23:52:53 2005] [notice] mod_python: Creating 20 session mutexes based on 20 max processes and 0 max threads.
[Tue Jan 25 23:52:53 2005] [notice] Apache/2.0.52 (Debian GNU/Linux) DAV/2 SVN/1.1.1 mod_python/3.1.3 Python/2.3.4 PHP/4.3.10-2 mod_perl/1.999.20 Perl/v5.8.4 configured -- resuming normal operations
[Tue Jan 25 23:53:01 2005] [error] [client 82.3.32.73] File does not exist: /var/www/agdev/favicon.ico
[Tue Jan 25 23:53:02 2005] [error] [client 82.3.32.73] PythonHandler MoinMoin.request::RequestModPy.run: Traceback (most recent call last):, referer: http://agdev.org/mywiki/
[Tue Jan 25 23:53:02 2005] [error] [client 82.3.32.73] PythonHandler MoinMoin.request::RequestModPy.run:   File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 299, in HandlerDispatch\n    result = object(req), referer: http://agdev.org/mywiki/
[Tue Jan 25 23:53:02 2005] [error] [client 82.3.32.73] PythonHandler MoinMoin.request::RequestModPy.run:   File "/usr/local/lib/python2.3/site-packages/MoinMoin/request.py", line 1689, in run\n    return RequestBase.run(self), referer: http://agdev.org/mywiki/
[Tue Jan 25 23:53:02 2005] [error] [client 82.3.32.73] PythonHandler MoinMoin.request::RequestModPy.run:   File "/usr/local/lib/python2.3/site-packages/MoinMoin/request.py", line 876, in run\n    self.write(u"\\n<!-- ERROR REPORT FOLLOWS -->\\n"), referer: http://agdev.org/mywiki/
[Tue Jan 25 23:53:02 2005] [error] [client 82.3.32.73] PythonHandler MoinMoin.request::RequestModPy.run:   File "/usr/local/lib/python2.3/site-packages/MoinMoin/request.py", line 1702, in write\n    self.mpyreq.write(self.encode(data)), referer: http://agdev.org/mywiki/
[Tue Jan 25 23:53:02 2005] [error] [client 82.3.32.73] PythonHandler MoinMoin.request::RequestModPy.run: IOError: Write failed, client closed connection., referer: http://agdev.org/mywiki/

I'm following all the instructions on the installation help page but whatever I do I get the problem. My apache config is:

<VirtualHost *>
    ServerName agdev.org

    DocumentRoot /var/www/agdev
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/agdev/>
        Options Indexes Includes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    Alias /wiki/ "/var/www/agdev-wiki/htdocs/"
    <Directory "/var/www/agdev-wiki/htdocs/>
        Order deny,allow
        Allow from all
    </Directory>

    #ScriptAlias /mywiki "/var/www/agdev-wiki/cgi-bin/moin.cgi"
    #<Directory "/var/www/agdev-wiki/cgi-bin/moin.cgi">
    #    Order deny,allow
    #    Allow from all
    #</Directory>

    # Rewrite urls
    #RewriteEngine On
    #RewriteLogLevel 0
    # map /wiki static files to Moin htdocs
    #RewriteRule ^/wiki/(.*)$ /var/www/agdev-wiki/htdocs/$1 [last]
    # map everything else to server script
    #RewriteRule ^(.*)$ /var/www/agdev-wiki/$1 [last]
    #RewriteRule ^(.*)$ /var/www/agdev-wiki/moinmodpy.py$1

    <Location /mywiki>
        SetHandler python-program
        PythonPath "['/var/www/agdev-wiki']+sys.path"
        PythonHandler MoinMoin.request::RequestModPy.run
    </Location>

    # hack hack hack!
    LogLevel crit
</VirtualHost>

I was in the middle of trying to make it work from the domain root but kept getting these errors so tried it as the installation suggested first. Then I realised that I was getting these errors whichever way round I run it (domain root ro at /mywiki). I will try to put it back on the domain root for now, anyway.

I hope this provides enough information -- if not please e-mail me matthew@agrip.org.uk

I still don't see the bug here - this config is simply broken; You can't run a root wiki with mod_python without using rewrite rules (commented in the example config). Also, add PythonDebug On. Please try the working configuration here: HelpOnConfiguration/ApacheVoodoo.

Check also that you use absolute paths in data_dir and data_underlay_dir.

You might want to add a rewrite rule or an alias for favicon.ico.

The problem is obvious: MoinMoin should not generate those errors in the normal case. Apache does not log interrupted connections with a segfault either ...

Its clear now that this has noting to do with the error handler.

I reproduced the second report:

[Tue Jan 25 23:53:02 2005] [error] [client 82.3.32.73] PythonHandler MoinMoin.request::RequestModPy.run: IOError: Write failed, client closed connection., referer: http://agdev.org/mywiki/

It is simply expected errror, and we should simply ignore it in RequestModpy.write, as we do in Standalone.

Any way, this is minor error and it does not effect the usability of the mod_python server. Its just an error that we should not log or complain about.

Plan

Ignore write error when client closed the connection, as its done in server/standalone.py


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/ModPyConnectionErrors (last edited 2008-01-16 21:50:54 by ThomasWaldmann)