[
https://issues.apache.org/jira/browse/COUCHDB-2834?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15246687#comment-15246687
]
Robert Newson commented on COUCHDB-2834:
----------------------------------------
Inferring the proposed patch is;
diff --git a/src/couch_doc.erl b/src/couch_doc.erl
index f973923..c43a6e4 100644
--- a/src/couch_doc.erl
+++ b/src/couch_doc.erl
@@ -402,14 +402,14 @@ doc_from_multi_part_stream(ContentType, DataFun, Ref) ->
{{started_open_doc_revs, NewRef}, Parser, _ParserRef} ->
restart_open_doc_revs(Parser, Ref, NewRef);
{{doc_bytes, Ref, DocBytes}, Parser, ParserRef} ->
+ erlang:put(mochiweb_request_recv, true),
Doc = from_json_obj(?JSON_DECODE(DocBytes)),
% we'll send the Parser process ID to the remote nodes so they can
% retrieve their own copies of the attachment data
WithParser = fun(follows) -> {follows, Parser, Ref}; (D) -> D end,
Atts = [couch_att:transform(data, WithParser, A) || A <- Doc#doc.atts],
WaitFun = fun() ->
- receive {'DOWN', ParserRef, _, _, _} -> ok end,
- erlang:put(mochiweb_request_recv, true)
+ receive {'DOWN', ParserRef, _, _, _} -> ok end
end,
{ok, Doc#doc{atts=Atts}, WaitFun, Parser};
ok -> ok
Nick's test script shows Connection:close in the response without this patch
and no such header with it.
How have we gone for so long without realising we set this value in the wrong
process? :)
Sidenote: Using the process dictionary is revolting. Cowboy is long overdue.
[~vatamane]: can you make a PR with that change pls?
> Server sends connection: close too early
> ----------------------------------------
>
> Key: COUCHDB-2834
> URL: https://issues.apache.org/jira/browse/COUCHDB-2834
> Project: CouchDB
> Issue Type: Bug
> Reporter: Nick Vatamaniuc
> Priority: Blocker
> Labels: has-pr
> Fix For: 2.0.0
>
>
> This is related COUCHDB-2833.
> This was found investigating the failure of replication tests. Specifically
> couch_replicator_large_atts_tests, the {local, remote} sub-case.
> The test sets up push replications from local to remote.
> Replication workers have more than 1 document larger than
> MAX_BULK_ATT_SIZE=64K. They start pushing them to the target, using a
> keep-alive connection (default for HTTP 1.1), the first few pipelined
> requests will go through using the same connection, then server will accept
> the first PUT to …/docid?edits=false, then return Connection:close and close
> the connection after the 201 Created result.
> Server should not close request too early and instead keep it open longer.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)