Edgewall Software
Modify

Opened 18 years ago

Last modified 7 months ago

#4033 new defect

exceptions.RuntimeError: Application didn't call startResponse before writing data!

Reported by: exarkun@… Owned by:
Priority: low Milestone: next-stable-1.6.x
Component: web frontend Version: devel
Severity: major Keywords: wsgi twisted
Cc: exarkun@…, Thijs Triemstra Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Got this traceback in my log file:

        Traceback (most recent call last):
          File "/usr/lib/python2.4/threading.py", line 422, in run
            self.__target(*self.__args, **self.__kwargs)
          File "/home/trac/Projects/Twisted/trunk/twisted/python/threadpool.py", line 148, in _worker
            context.call(ctx, function, *args, **kwargs)
          File "/home/trac/Projects/Twisted/trunk/twisted/python/context.py", line 59, in callWithContext
            return self.currentContext().callWithContext(ctx, func, *args, **kw)
          File "/home/trac/Projects/Twisted/trunk/twisted/python/context.py", line 37, in callWithContext
            return func(*args,**kw)
        --- <exception caught here> ---
          File "/home/trac/Projects/Twisted/trunk/twisted/web2/wsgi.py", line 199, in run
            self.handleResult(result)
          File "/home/trac/Projects/Twisted/trunk/twisted/web2/wsgi.py", line 289, in handleResult
            self.writeAll(result)
          File "/home/trac/Projects/Twisted/trunk/twisted/web2/wsgi.py", line 247, in writeAll
            raise RuntimeError(
        exceptions.RuntimeError: Application didn't call startResponse before writing data!

(No trac frames in there, sorry.)

The three requests made of the system with a nearby timestamp were logged as:

198.49.126.190 - - [27/Oct/2006:00:36:24 -0500] "GET /trac/ HTTP/1.0" 200 14837 "-" "-"
198.49.126.190 - - [27/Oct/2006:00:36:29 -0500] "POST /trac/ HTTP/1.0" 500 201 "-" "-"
198.49.126.190 - - [27/Oct/2006:00:36:47 -0500] "GET /trac/ticket/1757?format=rss HTTP/1.0" 200 6533 "-" "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)"

The POST which received a 500 response seems notable, but I have no idea what the post contents were.

As the traceback suggests, the server is running as a WSGI application in a Twisted container. The version of trac being run is trunk@4045.

Attachments (1)

trac-test.py (258 bytes ) - added by Thijs Triemstra 13 years ago.

Download all attachments as: .zip

Change History (20)

comment:1 by Christian Boos, 18 years ago

Keywords: wsgi added
Owner: changed from Jonas Borgström to Christian Boos

comment:2 by anonymous, 17 years ago

Cc: exarkun@… added

comment:3 by Christian Boos, 17 years ago

Keywords: twisted needinfo added

Mh, I wonder if we shouldn't start to use a new special keyword… (no that keyword is not exarkun but I really hesitated ;) )

Does that still happen?

comment:4 by anonymous, 17 years ago

Yep, still happens.

If I telnet to the trac web server and send

POST /trac HTTP/1.1
Host: servername

then I get back a 500 back (from Twisted) and the traceback in the log file.

I tried testing this on t.e.o to see what happens with a non-wsgi server but lighttpd wants me to type out more HTTP than I am willing to figure out right now ;)

comment:5 by sid, 17 years ago

Ticket is almost a year old now. Did you ever work this out?

comment:6 by exarkun@…, 17 years ago

I never did any further investigation.

comment:7 by sid, 16 years ago

Resolution: wontfix
Status: newclosed

Right, thanks for the response. The logged error appears to be all Twisted side, not Trac (to me at least). It doesn't look like this is holding up any of your installations either, so it appears safe to close this.

comment:8 by anonymous, 16 years ago

To be clear, despite there being no frames in the traceback which point to trac code, I still think this is a trac bug. Trac's WSGI application callable is returning a result without calling the start_response callable Twisted provides it. After Trac's WSGI application callable returns, there's nothing on the stack to point to trac code anymore. However, Twisted's WSGI container raises the RuntimeError when it notices that Trac's WSGI application callable never called start_response.

Of course it's entirely up to you to decide if this is worth fixing or not, but I want to make sure that it's clear there is a bug in trac here.

comment:9 by Christian Boos, 16 years ago

Milestone: 0.11.1
Priority: normallow
Resolution: wontfix
Severity: normalmajor
Status: closedreopened

For 0.11.x, I'll try to setup a Twisted server for Trac, and maybe I'll be able to fix all the remaining issues…

Can you give me some hints about how to do this? All I've found so far was: http://twistedmatrix.com/trac/browser/sandbox/exarkun/t.web2-wsgi-trac

Is there anything newer or a bit more documented?

comment:10 by anonymous, 16 years ago

You shouldn't need to use Twisted. Any sufficiently strict WSGI container will report the error. I've never used it, but http://pythonpaste.org/module-paste.lint.html might be just the thing.

comment:11 by Christian Boos, 16 years ago

Component: generalweb frontend
Keywords: needinfo removed

comment:12 by exarkun, 14 years ago

This persists in version 0.11.6, fwiw.

in reply to:  9 comment:13 by Thijs Triemstra, 13 years ago

Replying to cboos:

For 0.11.x, I'll try to setup a Twisted server for Trac, and maybe I'll be able to fix all the remaining issues…

Can you give me some hints about how to do this? All I've found so far was: http://twistedmatrix.com/trac/browser/sandbox/exarkun/t.web2-wsgi-trac

Is there anything newer or a bit more documented?

There's a Twisted WSGI document now and I'm attaching a test script that can be launched by running:

$ twistd -n web --wsgi trac-test.application
2011-03-28 15:10:18+0200 [-] Log opened.
2011-03-28 15:10:18+0200 [-] twistd 10.2.0+r31379 (/usr/local/bin/python 2.7.1) starting up.
2011-03-28 15:10:18+0200 [-] reactor class: twisted.internet.selectreactor.SelectReactor.
2011-03-28 15:10:18+0200 [-] twisted.web.server.Site starting on 8080
2011-03-28 15:10:18+0200 [-] Starting factory <twisted.web.server.Site instance at 0x3742518>

by Thijs Triemstra, 13 years ago

Attachment: trac-test.py added

comment:14 by Thijs Triemstra, 13 years ago

Cc: Thijs Triemstra added

comment:15 by Ryan J Ollos, 9 years ago

Milestone: next-minor-0.12.xnext-stable-1.0.x

comment:16 by Ryan J Ollos, 9 years ago

Owner: Christian Boos removed
Status: reopenednew

comment:17 by Ryan J Ollos, 7 years ago

Milestone: next-stable-1.0.xnext-stable-1.2.x

Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.

comment:18 by Ryan J Ollos, 4 years ago

Milestone: next-stable-1.2.xnext-stable-1.4.x

comment:19 by Ryan J Ollos, 7 months ago

Milestone: next-stable-1.4.xnext-stable-1.6.x

Milestone renamed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


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