500 http error when replicating with doc_ids=null
-------------------------------------------------
Key: COUCHDB-1248
URL: https://issues.apache.org/jira/browse/COUCHDB-1248
Project: CouchDB
Issue Type: Bug
Components: Replication
Affects Versions: 1.1
Environment: Apple OS X 10.6, CouchDB 1.1.0, Erlang R14B03
Reporter: Erick Tryzelaar
Fix For: 1.0.2
Couchdb 1.1.0 throws an exception when passing a null doc_ids. This error does
not happen in 1.0.2. Here's an example:
$ curl -H "content-type: application/json" -XPUT
"http://127.0.0.1:5984/couchrest-test"
$ curl -H "content-type: application/json" -XPUT
"http://127.0.0.1:5984/couchrest-test-replication"
$ curl -H "content-type: application/json" -XPOST -d
"{\"doc_ids\":null,\"target\":\"couchrest-test-replication\",\"create_target\":false,\"continuous\":false,\"source\":\"http://127.0.0.1:5984/couchrest-test\"}"
"http://127.0.0.1:5984/_replicate"
{"error":"case_clause","reason":"{error,\n {{{badmatch,\n {error,\n
{{case_clause,null},\n
[{couch_rep_changes_feed,init,1},\n {gen_server,init_it,6},\n
{proc_lib,init_p_do_apply,3}]}}},\n [{couch_rep,do_init,1},\n
{couch_rep,init,1},\n {gen_server,init_it,6},\n
{proc_lib,init_p_do_apply,3}]},\n
{child,undefined,\"f88508b53ee0a5ccd49aa64197f385ae\",\n
{gen_server,start_link,\n [couch_rep,\n
[\"f88508b53ee0a5ccd49aa64197f385ae\",\n
{[{<<\"doc_ids\">>,null},\n
{<<\"target\">>,<<\"couchrest-test-replication\">>},\n
{<<\"create_target\">>,false},\n {<<\"continuous\">>,false},\n
{<<\"source\">>,<<\"http://127.0.0.1:5984/couchrest-test\">>}]},\n
{user_ctx,null,\n [<<\"_admin\">>],\n
<<\"{couch_httpd_auth, default_authentication_handler}\">>}],\n
[]]},\n temporary,1,worker,\n [couch_rep]}}}"}
The couchdb log file reports:
[Fri, 12 Aug 2011 23:30:24 GMT] [info] [<0.6901.0>] 127.0.0.1 - - 'HEAD'
/couchrest-test/ 200
[Fri, 12 Aug 2011 23:30:24 GMT] [info] [<0.6902.0>] 127.0.0.1 - - 'GET'
/couchrest-test/ 200
[Fri, 12 Aug 2011 23:30:24 GMT] [info] [<0.6904.0>] 127.0.0.1 - - 'GET'
/couchrest-test/_local/f88508b53ee0a5ccd49aa64197f385ae 404
[Fri, 12 Aug 2011 23:30:24 GMT] [info] [<0.6905.0>] 127.0.0.1 - - 'GET'
/couchrest-test/_local/95173aa20da0c34f68b0ae173cf37d1e 404
[Fri, 12 Aug 2011 23:30:24 GMT] [error] [<0.6928.0>] {error_report,<0.328.0>,
{<0.6928.0>,crash_report,
[[{initial_call,
{couch_rep_changes_feed,init,['Argument__1']}},
{pid,<0.6928.0>},
{registered_name,[]},
{error_info,
{exit,
{{case_clause,null},
[{couch_rep_changes_feed,init,1},
{gen_server,init_it,6},
{proc_lib,init_p_do_apply,3}]},
[{gen_server,init_it,6},
{proc_lib,init_p_do_apply,3}]}},
{ancestors,
[<0.6919.0>,couch_rep_sup,
couch_primary_services,couch_server_sup,
<0.329.0>]},
{messages,[]},
{links,[<0.6919.0>]},
{dictionary,[]},
{trap_exit,true},
{status,running},
{heap_size,610},
{stack_size,24},
{reductions,134}],
[]]}}
[Fri, 12 Aug 2011 23:30:24 GMT] [error] [<0.6919.0>] {error_report,<0.328.0>,
{<0.6919.0>,crash_report,
[[{initial_call,{couch_rep,init,['Argument__1']}},
{pid,<0.6919.0>},
{registered_name,[]},
{error_info,
{exit,
{{badmatch,
{error,
{{case_clause,null},
[{couch_rep_changes_feed,init,1},
{gen_server,init_it,6},
{proc_lib,init_p_do_apply,3}]}}},
[{couch_rep,do_init,1},
{couch_rep,init,1},
{gen_server,init_it,6},
{proc_lib,init_p_do_apply,3}]},
[{gen_server,init_it,6},
{proc_lib,init_p_do_apply,3}]}},
{ancestors,
[couch_rep_sup,couch_primary_services,
couch_server_sup,<0.329.0>]},
{messages,
[{'EXIT',<0.6928.0>,
{{case_clause,null},
[{couch_rep_changes_feed,init,1},
{gen_server,init_it,6},
{proc_lib,init_p_do_apply,3}]}}]},
{links,[<0.379.0>]},
{dictionary,[]},
{trap_exit,true},
{status,running},
{heap_size,2584},
{stack_size,24},
{reductions,3370}],
[]]}}
[Fri, 12 Aug 2011 23:30:24 GMT] [error] [<0.6900.0>] Uncaught error in HTTP
request: {error,
{case_clause,
{error,
{{{badmatch,
{error,
{{case_clause,
null},
[{couch_rep_changes_feed,
init,1},
{gen_server,
init_it,6},
{proc_lib,
init_p_do_apply,
3}]}}},
[{couch_rep,
do_init,1},
{couch_rep,init,1},
{gen_server,
init_it,6},
{proc_lib,
init_p_do_apply,
3}]},
{child,undefined,
"f88508b53ee0a5ccd49aa64197f385ae",
{gen_server,
start_link,
[couch_rep,
["f88508b53ee0a5ccd49aa64197f385ae",
{[{<<"doc_ids">>,
null},
{<<"target">>,
<<"couchrest-test-replication">>},
{<<"create_target">>,
false},
{<<"continuous">>,
false},
{<<"source">>,
<<"http://127.0.0.1:5984/couchrest-test">>}]},
{user_ctx,null,
[<<"_admin">>],
<<"{couch_httpd_auth, default_authentication_handler}">>}],
[]]},
temporary,1,worker,
[couch_rep]}}}}}
[Fri, 12 Aug 2011 23:30:24 GMT] [info] [<0.6900.0>] Stacktrace:
[{io_lib_pretty,cind_tag_tuple,7},
{io_lib_pretty,while_fail,3},
{io_lib_pretty,print,6},
{io_lib_format,build,3},
{io_lib_format,build,3},
{io_lib_format,build,3},
{io_lib_format,build,3},
{io_lib_format,build,3}]
[Fri, 12 Aug 2011 23:30:24 GMT] [info] [<0.6900.0>] 127.0.0.1 - - 'POST'
/_replicate 500
In comparison, here's the replication without null doc_ids:
$ curl -H "content-type: application/json" -XPOST -d
"{\"target\":\"couchrest-test-replication\",\"create_target\":false,\"continuous\":false,\"source\":\"http://127.0.0.1:5984/couchrest-test\"}"
"http://127.0.0.1:5984/_replicate"
{"ok":true,"no_changes":true}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira