Re: 'premature end of script headers' error
"John P. Rouillard" <[email protected]>
| Newsgroups | gmane.comp.bug-tracking.roundup.user |
|---|---|
| Message-ID | <[email protected]> |
I had another thought: In message <[email protected]>, "John P. Rouillard" writes: >In message <[email protected]>, >Tom Ekberg writes: > >>I tracked the problem down to an error in my detector. It was trying >>to write to a file in /tmp as apache but the file was owned by me. >>Removing the write in my detector fixed the problem. > >Ah thanks for your work on this. Good job tracking this bug down. > >>The exception that was generated was this: >> >>2013-12-13 11:41:16,918 DEBUG Caught exception <type 'exceptions.IOError' >>>: [Errno 13] Permission denied: '/tmp/nic.log' >> >>Note that this is an IOError exception. If you look at the HG source code >> in roundup/cgi/client.py you can find the inner_main method. Here is >> a skeleton of that method: I fleshed out Tom's the skeleton a bit more: def inner_main(self): ... try: ... try: ... html = self.handle_action() ... if html: self.write_html(html) return ... # render the content self.write_html(self.renderContext()) except SendFile, designator: ... except IOError: # IOErrors here are due to the client disconnecting before # receiving the reply. pass ... Would enclosing the calls to self.write_html in a try/except block to handle IOError work? So: try: ... html = self.handle_action() ... if html: try: self.write_html(html) return except IOError: # IOErrors here are due to the client disconnecting # before receiving the reply pass ... # render the content try: self.write_html(self.renderContext()) except IOError: # IOErrors here are due to the client disconnecting # before receiving the reply pass ... except IOError: # IOErrors here are due to the client disconnecting before # receiving the reply. # get trceback and errors and log.error(...) Is this maybe a better implementation? It should ignore the IOError only when we try to write to the client and find it has gone away, but all other IO errors are captured and logged at a level that is normally logged. -- -- rouilj John Rouillard =========================================================================== My employers don't acknowledge my existence much less my opinions. ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk