You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "Robert Kowalski (JIRA)" <ji...@apache.org> on 2015/08/02 11:09:04 UTC
[jira] [Commented] (COUCHDB-2758) Deleting non-existent _local doc
in _bulk_docs causes 500
[ https://issues.apache.org/jira/browse/COUCHDB-2758?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14650660#comment-14650660 ]
Robert Kowalski commented on COUCHDB-2758:
------------------------------------------
It is fixed for 2.0:
{code}
(11:05:49) [robert@tequila-osx] ~/Downloads $ ./couch-2758.sh
{"ok":true}
{"ok":true}
{"ok":true,"id":"mothra","rev":"1-967a00dff5e02add41819138abb3284d"}
{"ok":true,"id":"rodan","rev":"1-967a00dff5e02add41819138abb3284d"}
* About to connect() to 127.0.0.1 port 5984 (#0)
* Trying 127.0.0.1...
* Adding handle: conn: 0x7f9200804000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f9200804000) send_pipe: 1, recv_pipe: 0
* Connected to 127.0.0.1 (127.0.0.1) port 5984 (#0)
> POST /testdb/_bulk_docs?_nonce=1438060065251 HTTP/1.1
> Host: 127.0.0.1:5984
> Origin: http://localhost:8000
> Accept-Encoding: gzip, deflate
> Accept-Language: en-US,en;q=0.8
> User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36
> Content-Type: application/json
> Accept: application/json
> Referer: http://localhost:8000/tests/integration/?grep=test.bulk_docs.js-http%20Deleting%20_local%20docs%20with%20bulkDocs%2C%20not%20found
> Connection: keep-alive
> Content-Length: 238
>
* upload completely sent off: 238 out of 238 bytes
< HTTP/1.1 201 Created
< X-CouchDB-Body-Time: 0
< X-Couch-Request-ID: 119aaed8e3
* Server CouchDB/4708e32 (Erlang OTP/17) is not blacklisted
< Server: CouchDB/4708e32 (Erlang OTP/17)
< Date: Sun, 02 Aug 2015 09:06:01 GMT
< Content-Type: application/json
< Content-Length: 201
< Cache-Control: must-revalidate
<
[{"ok":true,"id":"mothra","rev":"2-eec205a9d413992850a6e32678485900"},{"id":"_local/godzilla","error":"unknown_error","reason":"undefined"},{"id":"rodan","error":"unknown_error","reason":"undefined"}]
* Connection #0 to host 127.0.0.1 left intact
(11:06:01) [robert@tequila-osx] ~/Downloads $
{code}
> Deleting non-existent _local doc in _bulk_docs causes 500
> ---------------------------------------------------------
>
> Key: COUCHDB-2758
> URL: https://issues.apache.org/jira/browse/COUCHDB-2758
> Project: CouchDB
> Issue Type: Bug
> Security Level: public(Regular issues)
> Components: Database Core
> Reporter: Nolan Lawson
> Attachments: couch-2758.sh
>
>
> Normally you should be able to update/add/delete {{_local}} docs in a {{_bulk_docs}} request, but if the {{_local}} doc doesn't exist (or if the provided {{_rev}} is wrong), then the database throws an error.
> Attached is a bash script using cURL to reproduce. Notice I'm adding two normal docs ({{mothra}} and {{rodan}}) and then I attempt to delete those two in a {{_bulk_docs}} along with a nonexistent {{_local}} doc called {{_local/godzilla}}. (Sorry for the goofy theme; I've been getting tired of foo and bar.)
> I expect to get back an array of results describing the 2 docs that succeeded as well as the 1 doc that failed. Instead I get an error report:
> {code}
> {proc_lib,init_p_do_apply,3,
> [{file,"proc_lib.erl"},{line,237}]}]}}
> ** When Server state == {db,<0.3217.15>,<0.3218.15>,nil,
> <<"1438060201861904">>,<0.3216.15>,<0.3136.15>,
> <0.3220.15>,
> {db_header,6,0,0,nil,nil,nil,0,nil,nil,1000},
> 0,
> {btree,<0.3136.15>,
> {316,{2,0,78},116},
> #Fun<couch_db_updater.10.11117096>,
> #Fun<couch_db_updater.11.11117096>,
> #Fun<couch_btree.5.131744168>,
> #Fun<couch_db_updater.12.11117096>,snappy},
> {btree,<0.3136.15>,
> {432,2,103},
> #Fun<couch_db_updater.13.11117096>,
> #Fun<couch_db_updater.14.11117096>,
> #Fun<couch_btree.5.131744168>,
> #Fun<couch_db_updater.15.11117096>,snappy},
> {btree,<0.3136.15>,nil,
> #Fun<couch_btree.3.131744168>,
> #Fun<couch_btree.4.131744168>,
> #Fun<couch_btree.5.131744168>,nil,snappy},
> 2,<<"testdb">>,
> "/usr/local/var/lib/couchdb/testdb.couch",[],[],
> nil,
> {user_ctx,null,[],undefined},
> #Ref<0.0.16.194130>,1000,
> [before_header,after_header,on_file_open],
> [create,
> {user_ctx,
> {user_ctx,null,
> [<<"_admin">>],
> <<"{couch_httpd_auth, default_authentication_handler}">>}}],
> snappy,nil,nil}
> ** Reason for termination ==
> ** {function_clause,
> [{couch_db_updater,'-update_local_docs/2-fun-0-',
> [{<0.3111.15>,
> {{doc,<<"_local/godzilla">>,{1,[<<"fake">>]},{[]},[],true,[]},
> #Ref<0.0.16.194164>}},
> not_found],
> [{file,"couch_db_updater.erl"},{line,730}]},
> {lists,zipwith,3,[{file,"lists.erl"},{line,449}]},
> {couch_db_updater,update_local_docs,2,
> [{file,"couch_db_updater.erl"},{line,729}]},
> {couch_db_updater,update_docs_int,5,
> [{file,"couch_db_updater.erl"},{line,695}]},
> {couch_db_updater,handle_info,2,
> [{file,"couch_db_updater.erl"},{line,235}]},
> {gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,593}]},
> {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,659}]},
> {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]}
> [Tue, 28 Jul 2015 05:10:01 GMT] [error] [<0.3217.15>] {error_report,<0.30.0>,
> {<0.3217.15>,crash_report,
> [[{initial_call,{couch_db,init,['Argument__1']}},
> {pid,<0.3217.15>},
> {registered_name,[]},
> {error_info,
> {exit,
> {function_clause,
> [{couch_db_updater,
> '-update_local_docs/2-fun-0-',
> [{<0.3111.15>,
> {{doc,<<"_local/godzilla">>,
> {1,[<<"fake">>]},
> {[]},
> [],true,[]},
> #Ref<0.0.16.194164>}},
> not_found],
> [{file,"couch_db_updater.erl"},{line,730}]},
> {lists,zipwith,3,
> [{file,"lists.erl"},{line,449}]},
> {couch_db_updater,update_local_docs,2,
> [{file,"couch_db_updater.erl"},{line,729}]},
> {couch_db_updater,update_docs_int,5,
> [{file,"couch_db_updater.erl"},{line,695}]},
> {couch_db_updater,handle_info,2,
> [{file,"couch_db_updater.erl"},{line,235}]},
> {gen_server,try_dispatch,4,
> [{file,"gen_server.erl"},{line,593}]},
> {gen_server,handle_msg,5,
> [{file,"gen_server.erl"},{line,659}]},
> {proc_lib,init_p_do_apply,3,
> [{file,"proc_lib.erl"},{line,237}]}]},
> [{gen_server,terminate,7,
> [{file,"gen_server.erl"},{line,804}]},
> {proc_lib,init_p_do_apply,3,
> [{file,"proc_lib.erl"},{line,237}]}]}},
> {ancestors,[<0.3214.15>]},
> {messages,[]},
> {links,[<0.84.0>]},
> {dictionary,[]},
> {trap_exit,true},
> {status,running},
> {heap_size,1598},
> {stack_size,27},
> {reductions,403}],
> []]}}
> [Tue, 28 Jul 2015 05:10:01 GMT] [error] [<0.3111.15>] Uncaught error in HTTP request: {exit,
> {function_clause,
> [{couch_db_updater,
> '-update_local_docs/2-fun-0-',
> [{<0.3111.15>,
> {{doc,
> <<"_local/godzilla">>,
> {1,[<<"fake">>]},
> {[]},
> [],true,[]},
> #Ref<0.0.16.194164>}},
> not_found],
> [{file,
> "couch_db_updater.erl"},
> {line,730}]},
> {lists,zipwith,3,
> [{file,"lists.erl"},
> {line,449}]},
> {couch_db_updater,
> update_local_docs,2,
> [{file,
> "couch_db_updater.erl"},
> {line,729}]},
> {couch_db_updater,
> update_docs_int,5,
> [{file,
> "couch_db_updater.erl"},
> {line,695}]},
> {couch_db_updater,
> handle_info,2,
> [{file,
> "couch_db_updater.erl"},
> {line,235}]},
> {gen_server,
> try_dispatch,4,
> [{file,
> "gen_server.erl"},
> {line,593}]},
> {gen_server,
> handle_msg,5,
> [{file,
> "gen_server.erl"},
> {line,659}]},
> {proc_lib,
> init_p_do_apply,3,
> [{file,
> "proc_lib.erl"},
> {line,237}]}]}}
> [Tue, 28 Jul 2015 05:10:01 GMT] [error] [<0.84.0>] Unexpected exit of database process <0.3217.15> [<<"testdb">>]: {function_clause,
> [{couch_db_updater,
> '-update_local_docs/2-fun-0-',
> [{<0.3111.15>,
> {{doc,
> <<"_local/godzilla">>,
> {1,
> [<<"fake">>]},
> {[]},
> [],
> true,
> []},
> #Ref<0.0.16.194164>}},
> not_found],
> [{file,
> "couch_db_updater.erl"},
> {line,
> 730}]},
> {lists,
> zipwith,
> 3,
> [{file,
> "lists.erl"},
> {line,
> 449}]},
> {couch_db_updater,
> update_local_docs,
> 2,
> [{file,
> "couch_db_updater.erl"},
> {line,
> 729}]},
> {couch_db_updater,
> update_docs_int,
> 5,
> [{file,
> "couch_db_updater.erl"},
> {line,
> 695}]},
> {couch_db_updater,
> handle_info,
> 2,
> [{file,
> "couch_db_updater.erl"},
> {line,
> 235}]},
> {gen_server,
> try_dispatch,
> 4,
> [{file,
> "gen_server.erl"},
> {line,
> 593}]},
> {gen_server,
> handle_msg,
> 5,
> [{file,
> "gen_server.erl"},
> {line,
> 659}]},
> {proc_lib,
> init_p_do_apply,
> 3,
> [{file,
> "proc_lib.erl"},
> {line,
> 237}]}]}
> [Tue, 28 Jul 2015 05:10:01 GMT] [info] [<0.3111.15>] Stacktrace: [{couch_db,collect_results,3,
> [{file,"couch_db.erl"},{line,833}]},
> {couch_db,write_and_commit,4,
> [{file,"couch_db.erl"},{line,845}]},
> {couch_db,update_docs,4,
> [{file,"couch_db.erl"},{line,782}]},
> {couch_httpd_db,db_req,2,
> [{file,"couch_httpd_db.erl"},
> {line,330}]},
> {couch_httpd_db,do_db_req,2,
> [{file,"couch_httpd_db.erl"},
> {line,234}]},
> {couch_httpd,handle_request_int,5,
> [{file,"couch_httpd.erl"},{line,318}]},
> {mochiweb_http,headers,5,
> [{file,"mochiweb_http.erl"},{line,94}]},
> {proc_lib,init_p_do_apply,3,
> [{file,"proc_lib.erl"},{line,237}]}]
> [Tue, 28 Jul 2015 05:10:01 GMT] [error] [<0.3111.15>] {error_report,<0.30.0>,
> {<0.3111.15>,crash_report,
> [[{initial_call,
> {mochiweb_acceptor,init,
> ['Argument__1','Argument__2','Argument__3']}},
> {pid,<0.3111.15>},
> {registered_name,[]},
> {error_info,
> {error,badarg,
> [{erlang,list_to_binary,
> [[{couch_db_updater,
> '-update_local_docs/2-fun-0-',
> [{<0.3111.15>,
> {{doc,<<"_local/godzilla">>,
> {1,[<<"fake">>]},
> {[]},
> [],true,[]},
> #Ref<0.0.16.194164>}},
> not_found],
> [{file,"couch_db_updater.erl"},{line,730}]},
> {lists,zipwith,3,
> [{file,"lists.erl"},{line,449}]},
> {couch_db_updater,update_local_docs,2,
> [{file,"couch_db_updater.erl"},{line,729}]},
> {couch_db_updater,update_docs_int,5,
> [{file,"couch_db_updater.erl"},{line,695}]},
> {couch_db_updater,handle_info,2,
> [{file,"couch_db_updater.erl"},{line,235}]},
> {gen_server,try_dispatch,4,
> [{file,"gen_server.erl"},{line,593}]},
> {gen_server,handle_msg,5,
> [{file,"gen_server.erl"},{line,659}]},
> {proc_lib,init_p_do_apply,3,
> [{file,"proc_lib.erl"},{line,237}]}]],
> []},
> {couch_httpd,error_info,1,
> [{file,"couch_httpd.erl"},{line,818}]},
> {couch_httpd,send_error,2,
> [{file,"couch_httpd.erl"},{line,925}]},
> {couch_httpd,handle_request_int,5,
> [{file,"couch_httpd.erl"},{line,368}]},
> {mochiweb_http,headers,5,
> [{file,"mochiweb_http.erl"},{line,94}]},
> {proc_lib,init_p_do_apply,3,
> [{file,"proc_lib.erl"},{line,237}]}]}},
> {ancestors,
> [couch_httpd,couch_secondary_services,
> couch_server_sup,<0.31.0>]},
> {messages,[]},
> {links,[<0.101.0>,#Port<0.320113>]},
> {dictionary,
> [{mochiweb_request_body,
> <<"{\"new_edits\":true,\"docs\":[{\"_id\":\"mothra\",\"_rev\":\"1-967a00dff5e02add41819138abb3284d\",\"_deleted\":true},{\"_id\":\"_local/godzilla\",\"_rev\":\"1-fake\",\"_deleted\":true},{\"_id\":\"rodan\",\"_rev\":\"1-967a00dff5e02add41819138abb3284d\",\"_deleted\":true}]}">>},
> {couch_rewrite_count,0},
> {mochiweb_request_recv,true},
> {mochiweb_request_cookie,[]}]},
> {trap_exit,false},
> {status,running},
> {heap_size,4185},
> {stack_size,27},
> {reductions,11631}],
> []]}}
> [Tue, 28 Jul 2015 05:10:38 GMT] [info] [<0.3198.15>] 127.0.0.1 - - DELETE /testdb/ 200
> [Tue, 28 Jul 2015 05:10:38 GMT] [info] [<0.3047.15>] 127.0.0.1 - - PUT /testdb/ 201
> [Tue, 28 Jul 2015 05:10:38 GMT] [info] [<0.3049.15>] 127.0.0.1 - - PUT /testdb/mothra 201
> [Tue, 28 Jul 2015 05:10:38 GMT] [info] [<0.3221.15>] 127.0.0.1 - - PUT /testdb/rodan 201
> [Tue, 28 Jul 2015 05:10:38 GMT] [info] [<0.3227.15>] 127.0.0.1 - - POST /testdb/_bulk_docs?_nonce=1438060065251 201
> {code}
> Related to [PouchDB issue 4086 | https://github.com/pouchdb/pouchdb/issues/4086].
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)