[albatross-users] "Broken Pipe" tracebacks...

Dave Cole djc at object-craft.com.au
Mon Jan 10 10:04:56 EST 2005


Sheila King wrote:
> Hello,
> 
> I'm running a project that uses Albatross. Finally released our big project
> in December. Only, technically, accessible to our own clients with
> accounts, though...
> 
> http://www.QuestAdmin.net
> (It's still kind of beta-ish, but good enough that we made it available to
> our clients so they can view billing statements and such...)
> 
> I have the application set up to send me emails of the full Python
> traceback if there are any "unhandled" exceptions, which I then trap and
> redirect to an error page.
> 
> There is one type of error, however, that I'm seeing off and on...
> namely the "Broken Pipe" error. Here is a portion of a traceback:
> 
> (the last few lines of it...)
> 
>   File "albatross/context.py", line 123, in flush_content
>     self.send_content(data)
>   File "albatross/app.py", line 107, in send_content
>     self.request.write_content(data)
>   File "albatross/cgiapp.py", line 52, in write_content
>     sys.stdout.flush()
> IOError: [Errno 32] Broken pipe
> 
> 
> Because we are running this app as CGI, and because I have, in test use,
> actually caused this error myself but not been redirected to the error page
> mentioned above, I think this is just a case of the connection to the
> browser being closed before the cgiapp was able to completely flush the
> content?
> (We are running the latest stable version of albatross... 1.20.)
> 
> Was hoping for confirmation on this before I have my email function
> disregard sending me emails of tracebacks for this particular error...
> 
> Thanks for any insights or clues...

I think something like the following might explain what you are seeing...

The user is not waiting for the page from the server before browsing to 
another page.  In order to retrieve the new page, the browser is closes 
the connection to the server for the current unretrieved page and opens 
a new connection for the new request.

I am not entirely sure how Apache would handle this.  The CGI request is 
handled by Apache forking a child process and reading STDOUT of that 
process via a pipe as the browser response.  There are a number of ways 
that Apache could handle a closed browser connection.  It could 
immediately close the pipe to the child process, or it could read and 
discard the output from the child process.

A further complication to the Apache behaviour is that each Apache 
process will only serve a limited number of browser requests before 
exiting.  Presumably Apache determines that it has served a browser 
request if the browser closes the connection for that request.  If the 
closed browser connection described above is the last request that will 
be served, does the Apache process terminate immediately (before reading 
the lingering CGI process STDOUT)?

In any event, the broken pipe exception seems to indicate that Apache 
has closed the pipe used to read the STDOUT from the CGI process.

- Dave

-- 
http://www.object-craft.com.au



More information about the Albatross-users mailing list