Edgewall Software
Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#13439 closed defect (cantfix)

AssertionError: write() before start_response() on fcgi

Reported by: anonymous Owned by:
Priority: normal Milestone:
Component: web frontend Version: 1.4.1
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Have error on url roadmap/admin/general/plugin

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

 venvp27/lib/python2.7/site-packages/trac/web/_fcgi.py in run(self=<trac.web._fcgi.Request object>)
    569         """Runs the handler, flushes the streams, and ends the request."""
    570         try:
=>  571             protocolStatus, appStatus = self.server.handler(self)
    572         except:
    573             traceback.print_exc(file=self.stderr)
protocolStatus undefined, appStatus undefined, self = <trac.web._fcgi.Request object>, self.server = <trac.web._fcgi.WSGIServer object>, self.server.handler = <bound method WSGIServer.handler of <trac.web._fcgi.WSGIServer object>>
 venvp27/lib/python2.7/site-packages/trac/web/_fcgi.py in handler(self=<trac.web._fcgi.WSGIServer object>, req=<trac.web._fcgi.Request object>)
   1267                             write(data)
   1268                     if not headers_sent:
=> 1269                         write('') # in case body was empty
   1270                 finally:
   1271                     if hasattr(result, 'close'):
write = <function write>
 venvp27/lib/python2.7/site-packages/trac/web/_fcgi.py in write(data='')
   1208         def write(data):
   1209             assert type(data) is str, 'write() argument must be string'
=> 1210             assert headers_set, 'write() before start_response()'
   1211 
   1212             if not headers_sent:
headers_set = []
<type 'exceptions.AssertionError'>: write() before start_response()
      args = ('write() before start_response()',)
      message = 'write() before start_response()'

Not sure about component as mod_wsgi due fcgi

Attachments (0)

Change History (5)

comment:1 by Jun Omae, 3 years ago

Keywords: needinfo added
Priority: highnormal

Please provide System Information and Installed Plugins from your about page.

Also, I believe you don't use mod_wsgi. trac/web/_fcgi.py is used only from trac/web/fcgi_frontend.py.

comment:2 by Jun Omae, 3 years ago

Component: web frontend/mod_wsgigeneral
Keywords: needinfo removed
Milestone: 1.4.4
Resolution: cantfix
Status: newclosed

PluginIssue (th:SimpleMultiProjectPlugin). roadmap/admin/general/plugin page is not provide by Trac.

comment:3 by anonymous, 3 years ago

It's not about SimpleMultiProjectPlugin just situation when installing, eg. for each, restart screen with trac. Looks like case around .dist-info

pip install svn+https://trac-hacks.org/svn/pydocplugin/0.11/
pip install svn+https://trac-hacks.org/svn/fieldgroupsplugin/1.0/
pip install svn+https://trac-hacks.org/svn/finegrainedpageauthzeditorplugin/0.11/
pip install svn+https://trac-hacks.org/svn/htgroupeditorplugin/0.11/
pip install svn+https://trac-hacks.org/svn/usermanagerplugin/0.11
pip install svn+https://trac-hacks.org/svn/tracdownloaderplugin/0.11/

comment:4 by Jun Omae, 3 years ago

Please provide System Information and Installed Plugins from your about page (see comment:1).

comment:5 by Jun Omae, 3 years ago

Component: generalweb frontend
Summary: <type 'exceptions.AssertionError'>AssertionError: write() before start_response() on fcgi

I tried to reproduce the issue with Trac 1.4.3 and plugins in comment:3 on Apache with mod_fcgid, however unable to reproduce it.

I consider that the situation can happen when a plugin raise RequestDone without sending status and headers. I think the following assertion is not needed.

  • trac/web/_fcgi.py

    diff --git a/trac/web/_fcgi.py b/trac/web/_fcgi.py
    index b9be9ca4d..315006bb7 100644
    a b class WSGIServer(Server):  
    12071207
    12081208        def write(data):
    12091209            assert type(data) is str, 'write() argument must be string'
    1210             assert headers_set, 'write() before start_response()'
    12111210
    12121211            if not headers_sent:
    12131212                status, responseHeaders = headers_sent[:] = headers_set
Last edited 3 years ago by Jun Omae (previous) (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.