Edgewall Software

Opened 13 years ago

Closed 11 years ago

Last modified 10 years ago

#9973 closed defect (fixed)

Internal Server Errors — at Version 10

Reported by: sbranden@… Owned by: Jun Omae
Priority: normal Milestone: 0.12.6
Component: web frontend Version: 0.12.1
Severity: normal Keywords: mod_wsgi
Cc: Branch:
Release Notes:

Avoid noisy logs in apache error log with mod_wsgi if the client disconnects

API Changes:
Internal Changes:

Description (last modified by Remy Blank)

Upgrade from Trac 0.10 to 0.12.1 now results in the following server errors in the trac.log

2011-01-12 19:48:53,628 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
  File "/opt/lampp/lib/python2.5/site-packages/Trac-0.12.1-py2.5.egg/trac/web/main.py", line 511, in _dispatch_request
    dispatcher.dispatch(req)
  File "/opt/lampp/lib/python2.5/site-packages/Trac-0.12.1-py2.5.egg/trac/web/main.py", line 261, in dispatch
    req.send(output, content_type or 'text/html')
  File "/opt/lampp/lib/python2.5/site-packages/Trac-0.12.1-py2.5.egg/trac/web/api.py", line 412, in send
    self.write(content)
  File "/opt/lampp/lib/python2.5/site-packages/Trac-0.12.1-py2.5.egg/trac/web/api.py", line 532, in write
    self._write(data)
IOError: client connection closed
Trac Server Info:
System Information
Trac 	0.12.1
Genshi 	0.6
Pygments 	0.9
pysqlite 	2.3.2
Python 	2.5.1 (r251:54863, Oct 30 2007, 17:07:30) [GCC 3.4.6 20060404 (Red Hat 3.4.6-3)]
setuptools 	0.6c7
SQLite 	3.3.17
Subversion 	1.4.6 (r28521)
jQuery:	1.4.2

Change History (10)

comment:1 by Remy Blank, 13 years ago

Description: modified (diff)

Which web server and frontend (fcgi, mod_python, …) are you using?

in reply to:  1 comment:2 by anonymous, 13 years ago

Replying to rblank:

Which web server and frontend (fcgi, mod_python, …) are you using?

We are using mod_python with wsgi.

Apache/2.2.6 (Unix) DAV/2 
mod_ssl/2.2.6 
OpenSSL/0.9.8e 
mod_python/3.3.1 
Python/2.5.1 
mod_fastcgi/2.4.6 
SVN/1.6.9 
mod_apreq2-20051231/2.5.7 
mod_wsgi/1.3

comment:3 by anonymous, 12 years ago

We have the same problem from time to time with trac 0.12.2:

mod_wsgi (pid=2172): Exception occurred processing WSGI script 'C:/Program Files/Apache/cgi-bin/trac_ec.wsgi'.
Traceback (most recent call last):
   File "C:/Program Files/Apache/cgi-bin/trac_ec.wsgi", line 7, in application
     return dispatch_request(environ, start_request)
   File "C:\\Python27\\lib\\site-packages\\trac\\web\\main.py", line 479, in dispatch_request
     return _dispatch_request(req, env, env_error)
   File "C:\\Python27\\lib\\site-packages\\trac\\web\\main.py", line 555, in _dispatch_request
     send_internal_error(env, req, sys.exc_info())
   File "C:\\Python27\\lib\\site-packages\\trac\\web\\main.py", line 648, in send_internal_error
     req.send_error(exc_info, status=500, env=env, data=data)
   File "C:\\Python27\\lib\\site-packages\\trac\\web\\api.py", line 462, in send_error
     exc_info)
   File "C:\\Python27\\lib\\site-packages\\trac\\web\\main.py", line 511, in _dispatch_request
     dispatcher.dispatch(req)
   File "C:\\Python27\\lib\\site-packages\\trac\\web\\main.py", line 261, in dispatch
     req.send(output, content_type or 'text/html')
   File "C:\\Python27\\lib\\site-packages\\trac\\web\\api.py", line 416, in send
     self.write(content)
   File "C:\\Python27\\lib\\site-packages\\trac\\web\\api.py", line 536, in write
     self._write(data)
 IOError: failed to write data
Apache/2.2.9 (Win32) 
DAV/2 mod_ssl/2.2.9 
OpenSSL/1.0.0g 
SVN/1.7.3 
mod_wsgi/3.3 
Python/2.7.2 
mod_auth_sspi/1.0.4 
PHP/5.2.6

comment:4 by anonymous, 11 years ago

it's no problem says TH:#11149

the question is if Trac can suppress the exception message

comment:5 by anonymous, 11 years ago

would be helpful 'cause it spams my log file

in reply to:  4 comment:6 by Jun Omae, 11 years ago

Replying to anonymous:

the question is if Trac can suppress the exception message

It needs to apply the following patch.

  • trac/web/api.py

    diff --git a/trac/web/api.py b/trac/web/api.py
    index 3af271b..2bf0253 100644
    a b class Request(object):  
    626626        except (IOError, socket.error), e:
    627627            if e.args[0] in (errno.EPIPE, errno.ECONNRESET, 10053, 10054):
    628628                raise RequestDone
     629            # Note that mod_wsgi raises an IOError with only a message
     630            # if a client disconnects
     631            if 'mod_wsgi.version' in self.environ and \
     632               e.args[0] in ('failed to write data',
     633                             'client connection closed'):
     634                raise RequestDone
    629635            raise
    630636
    631637    # Internal methods

comment:7 by anonymous, 11 years ago

plz, apply the patch. I got tons of such annoying msgs too

comment:8 by Jun Omae, 11 years ago

Milestone: next-minor-0.12.x0.12.6
Owner: set to Jun Omae
Status: newassigned

Ok, I'll push the patch to 0.12-stable. There are the same noisy logs in my production environments using mod_wsgi.

comment:9 by anonymous, 11 years ago

thnx jomae

comment:10 by Jun Omae, 11 years ago

Keywords: mod_wsgi added
Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Fixed in [11841].

Note: See TracTickets for help on using tickets.