Description

Attempting to upload an attachment to a mod_python-based moin 1.7.0 wiki results in a traceback and a zero byte attachment uploaded. I have another moin 1.7.0 wiki using mod_fcgid that does not have this problem.

Having said that, the working one is using python 2.5.1 on Fedora 9 and the broken one is using python 2.4.3 on CentOS 5, so that may be the underlying cause.

Steps to reproduce

I'm using a fairly basic apache+mod_python config:

Alias /moin_static170 "/usr/share/moin/htdocs/"

<Directory "/usr/share/moin/htdocs/">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    <IfModule mod_expires.c>
         ExpiresActive On
         ExpiresDefault "access plus 1 year"
    </IfModule>
</Directory>

<Location /vwiki>
    SetHandler python-program
    PythonPath "['/srv/www/mywiki/cgi-bin'] + sys.path"
    PythonHandler MoinMoin.request.request_modpython::Request.run
</Location>
  1. Try to upload an attachment to any page.
  2. Traceback appears.
  3. Resulting attachment is zero bytes.

Component selection

Details

traceback.html

Workaround

Discussion

Strange, the traceback shows a close file (== the uploaded file) at a place where it rather expected an open file!? I guess we need more infos about how it is expected to work (or a mod_python user debugging it).

2008-07-07, TobinCataldo - I am getting the same I/O error on closed file when attempting an attachment:

  1. MoinMoin 1.7.0

  2. mod_python 3.3.1
  3. Python 2.5.1
  4. Windows Server 2003

It seems that after "args" is returned from request.request_modpython.Request._setup_args_from_cgi_form() it closes the file. Just before the return of decodeArgs() the file is open, but when it's put into postargs in request.setup_args() it's closed. It's failing returning an open file descriptor.

2008-07-11, MattMagin - I too am getting the same I/O error.

  1. MoinMoin 1.7.0

  2. mod_python 3.3.1
  3. Python 2.5
  4. Debian Etch

2008-07-11, AdrianRibao - I too am getting the same I/O error.

  1. MoinMoin 1.7.0

  2. mod_python 3.3.1
  3. Python 2.5
  4. Debian Lenny

2008-07-21, PaulHowarth - workaround as found in MoinMoin 1.7.1 seems to work for me

  1. MoinMoin 1.7.1

  2. mod_python 3.2.8 (note that the problem existed here, and I am not running mod_python 3.3.1)

  3. Python 2.4.3
  4. CentOS 5.2

2008-08-04, RomanLevitsky - workaround works for me.

  1. moinmoin 1.7.0
  2. mod_python 3.3.1 and 3.3.1_1
  3. Python 2.5.2
  4. FreeBSD 7.0

And please how can I regenerate those "request_modpython.pyc" and "request_modpython.pyo" files (I has to delete them to get new request_modpython.py file worked) ?

What you mean by "daemon process"? Moinmoin is running by apache with mod_python, and I already have restarted apache.

It's solved, by enabling web server write to that directory.

Plan

(!) Please switch to mod_wsgi as soon as possible. (!)


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/1.7ModPythonAttachmentUploadFails (last edited 2008-08-04 16:20:00 by RomanLevitsky)