couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Tisdall <>
Subject Re: result from _bulk_docs update being truncated
Date Fri, 08 Jun 2012 14:02:11 GMT
Okay...  For the moment I'm going to try the following change:

		while(!feof($s)) {
			//$response .= fgets($s);
			$response .= fread($s, 8192);

fgets() is intended to fetch results up until the line ending, which
don't think makes a lot of sense when the result (I think) never has
any line endings.  fread() simply reads the number of bytes indicated
in a binary-safe way.


On Fri, Jun 8, 2012 at 9:55 AM, Dave Cottlehuber <> wrote:
> On 8 June 2012 15:47, Tim Tisdall <> wrote:
>> I'm having a strange intermittent problem where the result returned
>> from a POST to _bulk_docs is being truncated.  I know it's being
>> truncated because the truncation makes the result invalid JSON and my
>> script throws an exception because it can't decode it.  However, I
>> can't replicate it consistently and it seems rather random.  I'm using
>> code nearly identical to CouchSimple on the wiki at
>> .
>> Right now it's consistently truncating after 65734 characters, but I
>> saw this occurring in another script at around 2^15 bytes.  I suspect
>> there's something awry with PHP's fsockopen, but I'm hoping someone
>> here has seen this and found a solution or work-around.
>> -Tim
> The std method for tracking these down is to insert a proxy or packet sniffer in
> between Couch and the library. Charles Proxy is very nice, feel free to select
> something else.
> A+
> Dave

View raw message