[ 
https://issues.apache.org/jira/browse/COUCHDB-266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12676278#action_12676278
 ] 

Christopher Lenz commented on COUCHDB-266:
------------------------------------------

First, here's a simple way to reproduce this problem:

$ ls -lh big.json
-rw-r--r--  1 chris  staff   1,1M 24 Feb 14:36 big.json

$ curl -T big.json http://localhost:5984/testing/big
curl: (55) Send failure: Broken pipe
{"error":"body_too_large","reason":"content_length"}


The problem is caused by a mistake in the mochiweb_request:stream_body/4 that 
jchris submitted to MochiWeb. I've confirmed that the bug is also in the 
Mochiweb repository, and will create an issue for that project.

The patch is simple enough:

Index: src/mochiweb/mochiweb_request.erl 
=================================================================== 
--- src/mochiweb/mochiweb_request.erl   (revision 747380) 
+++ src/mochiweb/mochiweb_request.erl   (working copy) 
@@ -182,7 +182,7 @@ 
             true ->  
                 {NewLength, [Bin | BinAcc]} 
             end 
-        end, {0, []}, ?MAX_RECV_BODY), 
+        end, {0, []}, MaxBody), 
     put(?SAVE_BODY, Body), 
     Body. 



> PUTting json docs > 1MB causes Uncaught error in HTTP request: 
> {exit,{body_too_large,content_length}} 
> ------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-266
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-266
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>    Affects Versions: 0.9
>         Environment:  Apache CouchDB 0.9.0a747258
>            Reporter: Jeff Hinrichs
>            Assignee: Christopher Lenz
>
> error displays itself when trying to PUT  a json document that is > 1MB.  
> First noticed in the python interface, confirmed with curl
> [Tue, 24 Feb 2009 13:30:00 GMT] [error] [<0.1113.0>] Uncaught error in HTTP 
> request: {exit,{body_too_large,content_length}}
> 2     
> 3     [Tue, 24 Feb 2009 13:30:00 GMT] [debug] [<0.1113.0>] Stacktrace: 
> [{mochiweb_request,stream_body,5},
> 4     {mochiweb_request,recv_body,2},
> 5     {couch_httpd,json_body,1},
> 6     {couch_httpd_db,db_doc_req,3},
> 7     {couch_httpd_db,do_db_req,2},
> 8     {couch_httpd,handle_request,3},
> 9     {mochiweb_http,headers,4},
> 10    {proc_lib,init_p,5}] 
> modifying src/mochiweb/mochiweb_request.erl > -define(MAX_RECV_BODY, 
> (1024*1024)) 
> to something bigger, say -define(MAX_RECV_BODY, (1024*1024*16))
> alleviates the problem temporarily.
> issue confirmed by cmlenz on irc, he believed it to be a regression

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to