Just applied this patch on 1.6.0-rc1 and run it on your test server -
issue still exists.

Somehow, but it takes ~120 secs to transfer 9MB within from localhost
server to localhost client, there is some debug output that I'd add:

[info] [<0.342.0>] <0.336.0>: requesting post
"http://127.0.0.1:27786/couch_test_rep_db_b/_revs_diff"; [{"Accept",

                                 "application/json"},

                                {"Content-Type",

                                 "application/json"},

                                {"User-Agent",

                                 "CouchDB/0.0.0"}]
[info] [<0.342.0>] <0.336.0>: got response in 0 sec
[info] [<0.342.0>] <0.336.0>: requesting put
"http://127.0.0.1:27786/couch_test_rep_db_b/doc9?new_edits=false";
[{"Accept",

                                          "application/json"},

                                         {"Content-Length",

                                          9019252},

                                         {"Content-Type",

                                          "multipart/related;
boundary=\"d0b1be0e0754a41b1dd5db669ed0f29b\""},

                                         {"User-Agent",

                                          "CouchDB/0.0.0"}]
[info] [<0.342.0>] <0.336.0>: got response in 120 sec
[info] [<0.342.0>] <0.336.0>: requesting post
"http://127.0.0.1:27786/couch_test_rep_db_b/_revs_diff"; [{"Accept",

                                 "application/json"},

                                {"Content-Type",

                                 "application/json"},

                                {"User-Agent",

                                 "CouchDB/0.0.0"}]
[info] [<0.342.0>] <0.336.0>: got response in 0 sec

and after second PUT of document with 9MB attachment test fails with timeout.

And here is more interesting logs:
https://www.friendpaste.com/7BOCpdlWxnDpmRWXsNQjI7
I add wrappers around gen_tcp:send call at:
https://github.com/apache/couchdb/blob/master/src/ibrowse/ibrowse_http_client.erl#L560

do_send/2 >>> - before gen_tcp:send call
do_send/2 <<< - after gen_tcp:send call

Note the timings how it rapidly starts but than looks like it hits
some limit and transfer goes by very short chunks which are divided by
this gen_tcp:send call and timeout lasts always around 200
milliseconds. Also sometimes the next message arrives from ibrowse
tracing:
2014-1-29_9:6:25:259 -- (127.0.0.1:55867) - Inactivity timeout
triggered. Shutting down connection

Any ideas why so?

--
,,,^..^,,,


On Wed, Jan 29, 2014 at 11:55 AM,  <d...@apache.org> wrote:
> Updated Branches:
>   refs/heads/1986-fix-ibrowse-infinite-async-timeout [created] b35884580
>
>
> ibrowse: fix async hang due to infinite timeout
>
> - import upstream timeout fix[1]
> - addresses COUCHDB-1986 and quite possibly COUCHDB-1874 as well
>
> [1]: https://github.com/cmullaparthi/ibrowse/pull/91.patch
>
>
> Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
> Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/b3588458
> Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/b3588458
> Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/b3588458
>
> Branch: refs/heads/1986-fix-ibrowse-infinite-async-timeout
> Commit: b35884580436824adc7f250d9adbe857440026d7
> Parents: 5c9f9a9
> Author: Dave Cottlehuber <d...@apache.org>
> Authored: Wed Jan 29 07:29:35 2014 +0100
> Committer: Dave Cottlehuber <d...@apache.org>
> Committed: Wed Jan 29 08:28:34 2014 +0100
>
> ----------------------------------------------------------------------
>  src/ibrowse/ibrowse_http_client.erl | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/couchdb/blob/b3588458/src/ibrowse/ibrowse_http_client.erl
> ----------------------------------------------------------------------
> diff --git a/src/ibrowse/ibrowse_http_client.erl 
> b/src/ibrowse/ibrowse_http_client.erl
> index a1cf6eb..0ba5e97 100644
> --- a/src/ibrowse/ibrowse_http_client.erl
> +++ b/src/ibrowse/ibrowse_http_client.erl
> @@ -226,12 +226,12 @@ handle_info({ssl_error, _Sock, Reason}, State) ->
>      {stop, normal, State};
>
>  handle_info({req_timedout, From}, State) ->
> -    case lists:keymember(From, #request.from, 
> queue:to_list(State#state.reqs)) of
> +    case lists:keysearch(From, #request.from, 
> queue:to_list(State#state.reqs)) of
>          false ->
>              {noreply, State};
> -        true ->
> +        {value, #request{stream_to = StreamTo, req_id = ReqId}} ->
> +            catch StreamTo ! {ibrowse_async_response_timeout, ReqId},
>              shutting_down(State),
> -%%            do_error_reply(State, req_timedout),
>              {stop, normal, State}
>      end;
>
>

Reply via email to