Pylons .9 and FastCGI

12 views
Skip to first unread message

cap...@gmail.com

unread,
Jul 30, 2006, 8:30:16 AM7/30/06
to pylons-discuss
After upgrading to pylons .9 my production deployment with FastCGI
raises a new exception:

Traceback (most recent call last):
File
"/usr/lib/python2.4/site-packages/flup-0.5-py2.4.egg/flup/server/fcgi_base.py",
line 560, in run
protocolStatus, appStatus = self.server.handler(self)
File
"/usr/lib/python2.4/site-packages/flup-0.5-py2.4.egg/flup/server/fcgi_base.py",
line 1104, in handler
write(data)
File
"/usr/lib/python2.4/site-packages/flup-0.5-py2.4.egg/flup/server/fcgi_base.py",
line 1048, in write
assert headers_set, 'write() before start_response()'
AssertionError: write() before start_response()

I followed the FastCGI w/ mod_rewrite tutorial on the Wiki, it worked
for .8

Any ideas?

James Gardner

unread,
Jul 30, 2006, 8:38:02 AM7/30/06
to pylons-...@googlegroups.com
Could you please try disabling the ErrorDocuments middleware by
commenting it out in config/middleware.py, restarting the FastCGI
processes and letting me know the result?

Cheers,

James

cap...@gmail.com

unread,
Jul 30, 2006, 8:48:47 AM7/30/06
to pylons-discuss
I did so, and ended up with the same result. I checked through my
controller to see what might be causing it (one of the pages worked,
the rest did not) and I have a redirect in there.

if g.user.authenticated == True:
h.redirect_to('/journal')

If I avoid any redirect calls then the application works. This was
recently ported from 0.8, is there a different or more appropriate way
to do header redirects in .9?

Thanks,
mike

James Gardner

unread,
Jul 31, 2006, 4:28:29 PM7/31/06
to pylons-...@googlegroups.com
Hi Mike,

I'm not sure about this in that case, perhaps Ben might know? I've added
a ticket to remind me to look into it in detail:

http://www.pylonshq.com/project/pylonshq/ticket/88

James

iGL

unread,
Jul 31, 2006, 4:47:34 PM7/31/06
to pylons-discuss
Does you app work with the built-in server?

Philip Jenvey

unread,
Jul 31, 2006, 7:50:26 PM7/31/06
to pylons-...@googlegroups.com

I've found an issue with the latest Beaker under flup-0.5 FastCGI.
Beaker was sending bad headers (a None value) during HTTP redirects.
This is probably the issue you're seeing, although the exception
traceback I saw was different:

Module pylons.error:335 in detect_start_response
return start_response(status, headers, exc_info)
Module paste.errordocument:172 in change_response
return start_response(status, headers, exc_info)
Module flup.server.fcgi_base:1102 in start_response
assert type(val) is str, 'Header values must be strings'
exceptions.AssertionError: Header values must be strings

Please give the latest Beaker a shot; I believe these are the same
issues unearthing themselves differently. To install the latest
Beaker via easy_install, do:

easy_install -U http://beaker.groovie.org/svn/trunk/Beaker

FYI: I did not see this error under the normal Paste http server. It
must do less assertion checks than flup does; I'll see if I can sync
those up or at least log a Paste ticket about it.

--
Philip Jenvey

cap...@gmail.com

unread,
Aug 1, 2006, 10:10:19 AM8/1/06
to pylons-discuss
I updated beaker and it worked perfectly. It was working fine with the
paster server, but not with flup. Thanks!

-mike

Chas Emerick

unread,
Aug 7, 2006, 5:01:16 PM8/7/06
to pylons-discuss
We just updated to 0.9 final, and started seeing these errors -- we saw
both varieties of error (one under flup_scgi_thread, the other under
PasteScript#wsgiutils.

Installing the latest beaker from the trunk as Philip suggested did the
trick.

Just thought I'd confirm Mike's success.

Chas Emerick
http://snowtide.com

Reply all
Reply to author
Forward
0 new messages