benoitc / couchbeam

Apache CouchDB client in Erlang
Other
242 stars 113 forks source link

Bad error reporting in couchbeam_view:fetch: {error,timeout} #102

Closed behrad closed 9 years ago

behrad commented 10 years ago

When a view call gets an error from couchdb (e.g. bad starkey, bad request) OR in underlying transport gen_server (connect_failed) the process crashes (which it should have been handled), since couchbeam_view waits till it timeouts.

behrad commented 10 years ago

This is the underlying error message when couchbeam_view:fetch returns a timeout!

CRASH REPORT Process <0.5963.0> with 0 neighbours crashed with reason: {timeout,[{couchbeam_view_stream,do_init_stream,2,[{file,"src/couchbeam_view_stream.erl"},{line,116}]},{couchbeam_view_stream,init_stream,5,[{file,"src/couchbeam_view_stream.erl"},{line,72}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]}

benoitc commented 10 years ago

Do you have any useful trace I can use?

behrad commented 10 years ago

Was not this useful?

{timeout,[{couchbeam_view_stream,do_init_stream,2,[{file,"src/couchbeam_view_stream.erl"},{line,116}]},{couchbeam_view_stream,init_stream,5,[{file,"src/couchbeam_view_stream.erl"},{line,72}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]}

benoitc commented 10 years ago

ah sorry,.... was confused by the one lie textarea. Yes it is, thanks!

behrad commented 10 years ago

;)

benoitc commented 10 years ago

Ah well it's expected that the process crash at this point. It exit with the timeout reason.

behrad commented 10 years ago

Can't get you! This is not a normal API behavior. When an error crashes the process, I would like to see the specific error returned to me, not 'timeout'

benoitc commented 10 years ago

Well are you actually sure there is an error before? Any test that could help me to reproduce it?

behrad commented 10 years ago

Try to pass invalid start/end-key to your calls.

benoitc commented 10 years ago

yeah. I did and didn't reproduce it.

On Wed, Jan 22, 2014 at 10:21 PM, Behrad notifications@github.com wrote:

Try to pass invalid start/end-key to your calls.

— Reply to this email directly or view it on GitHubhttps://github.com/benoitc/couchbeam/issues/102#issuecomment-33069559 .

behrad commented 10 years ago

oh ok, then I'll try it and let you know in a few days

2014/1/23 Benoit Chesneau notifications@github.com

yeah. I did and didn't reproduce it.

On Wed, Jan 22, 2014 at 10:21 PM, Behrad notifications@github.com wrote:

Try to pass invalid start/end-key to your calls.

— Reply to this email directly or view it on GitHub< https://github.com/benoitc/couchbeam/issues/102#issuecomment-33069559> .

— Reply to this email directly or view it on GitHubhttps://github.com/benoitc/couchbeam/issues/102#issuecomment-33069649 .

--Behrad

benoitc commented 10 years ago

thanks :)

On Wed, Jan 22, 2014 at 10:25 PM, Behrad notifications@github.com wrote:

oh ok, then I'll try it and let you know in a few days

2014/1/23 Benoit Chesneau notifications@github.com

yeah. I did and didn't reproduce it.

On Wed, Jan 22, 2014 at 10:21 PM, Behrad notifications@github.com wrote:

Try to pass invalid start/end-key to your calls.

— Reply to this email directly or view it on GitHub< https://github.com/benoitc/couchbeam/issues/102#issuecomment-33069559> .

— Reply to this email directly or view it on GitHub< https://github.com/benoitc/couchbeam/issues/102#issuecomment-33069649> .

--Behrad

— Reply to this email directly or view it on GitHubhttps://github.com/benoitc/couchbeam/issues/102#issuecomment-33069924 .

benoitc commented 10 years ago

ping

behrad commented 10 years ago

@benoitc sorry, busy these days. I will post in a day or two.

behrad commented 10 years ago

pardon for the delay @benoitc You can simply call a non-existing view name by couchbeam_view:fold(fun({Row},Acc) -> [Row|Acc] end,[],Db,{<<"invalid_name">>, <<"some_design_doc">>},[{reduce,false},{startkey, [<<"00">>]},{endkey, [<<"01">>]}]). you will see couchdb immediately returns 404 but the above call blocks until it times out!! I would not expect this behavior for my call, and it also will freeze my whole system under load.

benoitc commented 9 years ago

Fixed in master.