Opened 18 years ago
Last modified 14 months ago
#4033 new defect
exceptions.RuntimeError: Application didn't call startResponse before writing data!
Reported by: | 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)
Change History (20)
comment:1 by , 18 years ago
Keywords: | wsgi added |
---|---|
Owner: | changed from | to
comment:2 by , 18 years ago
Cc: | added |
---|
comment:3 by , 18 years ago
Keywords: | twisted needinfo added |
---|
comment:4 by , 18 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:7 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
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 , 17 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.
follow-up: 13 comment:9 by , 17 years ago
Milestone: | → 0.11.1 |
---|---|
Priority: | normal → low |
Resolution: | wontfix |
Severity: | normal → major |
Status: | closed → reopened |
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 , 17 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 , 17 years ago
Component: | general → web frontend |
---|---|
Keywords: | needinfo removed |
comment:13 by , 14 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 , 14 years ago
Attachment: | trac-test.py added |
---|
comment:14 by , 14 years ago
Cc: | added |
---|
comment:15 by , 10 years ago
Milestone: | next-minor-0.12.x → next-stable-1.0.x |
---|
comment:16 by , 9 years ago
Owner: | removed |
---|---|
Status: | reopened → new |
comment:17 by , 8 years ago
Milestone: | next-stable-1.0.x → next-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 , 5 years ago
Milestone: | next-stable-1.2.x → next-stable-1.4.x |
---|
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?