Re: 'premature end of script headers' error

Tom Ekberg <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <[email protected]>
Bernhard,

Oops, I forgot the import for logging. Here is the hg diff for client.py

$ hg diff client.py
diff -r 740402e61479 roundup/cgi/client.py
--- a/roundup/cgi/client.py     Tue May 21 12:53:20 2013 -0700
+++ b/roundup/cgi/client.py     Fri Dec 13 13:58:52 2013 -0800
@@ -6,6 +6,7 @@
  import quopri, random, re, rfc822, stat, sys, time
  import socket, errno
  from traceback import format_exc
+import logging

  try:
      from OpenSSL.SSL import SysCallError
@@ -486,10 +487,14 @@
                  self.serve_file(designator)
              except SendStaticFile, file:
                  self.serve_static_file(str(file))
-            except IOError:
+            except IOError as e:
                  # IOErrors here are due to the client disconnecting before
                  # receiving the reply.
-                pass
+                # They can also be caused by detector errors.
+                import traceback
+                tb = traceback.format_exc()
+                lg = logging.getLogger('roundup')
+                lg.debug('Caught exception %s: %s\n%s' % (str(type(e)), e, tb))
              except SysCallError:
                  # OpenSSL.SSL.SysCallError is similar to IOError above
                  pass

Tom Ekberg
Senior Computer Specialist, Lab Medicine
University of Washington Medical Center
1959 NE Pacific St, MS 357110
Seattle WA 98195
cell: (253) 561-2509
email: [email protected]

On Thu, 12 Dec 2013, Bernhard Reiter wrote:

> Tom,
>
> On Wednesday 11 December 2013 at 23:08:52, Tom Ekberg wrote:
>> Thank you for your response. I can find no traceback. None in the log file,
>> nor the apache ssl_error_log which is where I have seen stack traces
>> before. I peppered my systems tracker's roundup.cgi with more log messages
>> - there is no python error at that level.  I made sure to catch any
>> exception.
>
> hmmm, yes this is strange, but it was important to check.
>
>> I wrote a wrapper class (snarfed most of the code from
>> http://code.activestate.com/recipes/577555-object-wrapper-class/) to have
>> HTML text go to the log file as well as to sys.stdout. When I'm displaying
>> the issue detail (issue.item.html) I see lots of HMTL in the log file. When
>> I change a simple attribute and press the 'submit' button I see the SQL
>> statements that I saw before, but no HTML text. This is why apache is
>> complaining about the script headers - there aren't any. I'll have to dig
>> deeper in the roundup/cgi/* code to determine where the error is. I'm
>> thinking that something like this happens:
>>
>>    create DB transaction
>>    do a lot of selects
>>    perform update and inserts
>>    some unknown error happens
>>    transaction is aborted
>
> Yes, this seems to be a good starting hypothesis.
> You could try to verify it maybe by the database side,
> if there is more diagnostics, it may tell you if the transaction was actually
> aborted.
>
>> I'm pretty certain the database itself isn't the problem. I modified the
>> same issue's attribute with roundup-admin and it works fine. I also did the
>> UPDATE cut/pasted from the log using psql (the postgres command line) while
>> logged as the user I'm using in the tracker. That also works fine.
>
> It still could be the database because of timing or so, but I also would try
> to falsify other hypothesis first.
>
>> If you think I'm going down the wrong path (digging into the roundup/cgi/*
>> code) I'd appreciate your input.
>
> The result probably comes out of the db layer, maybe that is another place
> where you can try to detect and track the infection (bad behaviour
> propagating).
>
> Let us know about your progress. ;)
> Bernhard
>
> -- 
> www.intevation.de/~bernhard (CEO)    www.fsfe.org (Founding GA Member)
> Intevation GmbH, Osnabrück, Germany; Amtsgericht Osnabrück, HRB 18998
> Owned and run by Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner
>

------------------------------------------------------------------------------
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

_______________________________________________
Roundup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/roundup-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.