[jQuery] AJAX response randomly ends prematurely. Any ideas?

[jQuery] AJAX response randomly ends prematurely. Any ideas?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16481" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>I'm struggling with a weird yet randomly
reproducable constant problem in our systems jQuery
AJAX-responses.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Some of our pages have links that trigger the
loading of content in a large div in the page. Rather basic fetching of HTML
with jQuery. The problem is that randomly, approximately once out of ten
requests, the response from the server is cut short. Only about half of the HTML
seems to arrive and is put into the div. Obviously this messes things
up.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>First thing I did, obviously was to take a deep
look at the php script producing this bit of HTML, to see if there was something
wacky. After some digging though, It seems that the problem does not lie in the
script producing the content, but propably somewhere within apache, http-request
headers or the parsing of the response. I'm asking here because I hope someone
here could point me to the right direction. Google has'nt really been my friend
on this.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>The facts (please do check these before
replying):</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>A) The effect is totally random, approximately 1
out of 10 times the response is cut short.</FONT></DIV>
<DIV><FONT face=Arial size=2>B) The response does not get cut from the same spot
every time</FONT></DIV>
<DIV><FONT face=Arial size=2>C) Looking at Firebug, the response is cut short
there too, this would lead me to assume it's not a problem with my jQuery code,
but rather the actualy HTTP response really is cut short.</FONT></DIV>
<DIV><FONT face=Arial size=2>D) Opening the page that is loaded with ajax in a
normal browser window and refreshing it never produces the error. The error only
happens when this same URL is loaded with AJAX. This stronly makes me believe
the error does not lie within the underlying php script or page, which is really
basic).</FONT></DIV>
<DIV><FONT face=Arial size=2>E) The error happens at least on 2 completely
different pages dynamically loading two different urls on the same server. (This
also would point away from a php error)</FONT></DIV>
<DIV><FONT face=Arial size=2>F) Have tried the exact same code on another
identical server with identical results</FONT></DIV>
<DIV><FONT face=Arial size=2>G) So far I've only managed to reproduce the
problem when I'm browsing through an SSH-tunnel. using an identical server
in LAN without SSH in between seems to work fine. This is not conclusive
however, I've not had a chance to test the exact same server with bot offsite
ssh-tunneling and onsite lan without ssh.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I'm strongly suspecting some Apache setting to be
causing this. The response headers indicate "Transfer-Encoding: chunked", but I
couldn't find anyone else having a problem with it and AJAX. Plus the fact that
most pages work fine, and even the problematic ones totally randomly
fail.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Any ideas really appreciated. Debugging this has
proven to be extremely difficult.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I'm sorry I cant product a live example at this
moment. It might prove to be rather difficult, and might actually be a bit
irrelevant since I really don't think the code is to blame here.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>What could either cause the server to send clipped
responses, or to make the browser evaluate the response as complete when in fact
it might not yet be?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>-- </FONT></DIV>
<DIV><FONT face=Arial size=2>Suni</FONT></DIV></BODY></HTML>