<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Update: I added a routine dataReceivedBufLen() to the LineReceiver class and call it to check if there is any pending data when the lost connection callback is called on the connection.&nbsp; There is no pending buffered data when the connection is lost.&nbsp; This implies I am using twisted properly, and maybe the bug is in the program on the other end of the connection.<br><br>Thanks,<br>Arun<br><br>--- On <b>Fri, 6/10/11, A Desai <i>&lt;ardesai@yahoo.com&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: A Desai &lt;ardesai@yahoo.com&gt;<br>Subject: Re: Debugging truncated response.. (REPOST to fix newlines)<br>To: twisted-web@twistedmatrix.com<br>Date: Friday, June 10, 2011, 3:49 PM<br><br><div id="yiv1352021923"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td
 style="font:inherit;" valign="top">I am trying to debug a scenario wherein a program has an http channel/transport <br>that receives an HTTP response; and in some cases (5 out of 10,000) the <br>channel/transport invokes the lost connection callback while the amount of data <br>received is less than the content length.&nbsp; The connection is used as a producer <br>to write to another connection.<br><br>I am trying to debug to check whether:<br>(1) the last chunk (20K+) of data sitting in the incoming response is not being <br>propagated up, e.g. due to a prior pauseProducing() call, or <br><br>(2) the data was not sent from the peer (e.g. connection closed without using so_linger)<br><br>In general, I "presume" lost connection callback on a producer socket would not <br>be called if there is pending (paused) data that has yet to be written a <br>consumer (socket).&nbsp; I am also assuming that
 the assert in <br>internet/abstract.py::resumeProducing() [self.connected and not self.disconnecting] is valid.&nbsp; <br>I.E: If someone can confirm that scenario (1) above is not possible in twisted (unless a bug).<br><br>By the time the lost connection callback is called, the transport channel is gone.&nbsp; <br>I would have to instrument either tcp.py, basic.py, or abstract.py to track this.<br><br>Any clues/suggestions welcome.<br><br>Thanks.<br>-Arun<br><br><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px;"><div id="yiv1352021923"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font:inherit;" valign="top"><br></td></tr></tbody></table></div></blockquote></td></tr></tbody></table></div></blockquote></td></tr></table>