classification
Title: cgi.py spam in Apache server logs
Type: Stage:
Components: Library (Lib) Versions: Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: srittau, yoch.melka
Priority: normal Keywords:

Created on 2016-10-06 12:00 by srittau, last changed 2019-03-29 11:49 by yoch.melka.

Messages (2)
msg278186 - (view) Author: Sebastian Rittau (srittau) * Date: 2016-10-06 12:00
I am using cgi.py in WSGI applications, using Apache and mod_wsgi. Unfortunately cgi.py keeps spamming the error log with messages like the following:

Exception ignored in: <bound method FieldStorage.__del__ of FieldStorage(None, None, [])>
Traceback (most recent call last):
  File "/usr/lib/python3.5/cgi.py", line 566, in __del__
NameError: name 'AttributeError' is not defined

This is mostly likely due to the warning about __del__ in <https://docs.python.org/3/reference/datamodel.html>, i.e. AttributeError will already have been cleaned at the time FieldStorage is collected. One workaround that seems to work for me is to cache AttributeError in the constructor of FieldStorage in self and use that attribute during __del__.
msg339104 - (view) Author: yoch (yoch.melka) Date: 2019-03-29 11:49
Same issue here (python 3.6). This is very annoying, especially in case of large entries in FieldStorage, because the whole data is written to the log.

Example:
    FieldStorage('image', 'upload.jpg', b'...can be very long...')
History
Date User Action Args
2019-03-29 11:49:07yoch.melkasetnosy: + yoch.melka
messages: + msg339104
components: + Library (Lib)
2016-10-06 12:00:23srittaucreate