[
https://issues.apache.org/jira/browse/COUCHDB-537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13693366#comment-13693366
]
Alexander Shorin commented on COUCHDB-537:
------------------------------------------
Fix issue summary and raise priority since CouchDB doesn't even returns HTTP
500 response. Just closes connection for case of invalid builtin reduce
function call:
CouchDB:
{code}
{"couchdb":"Welcome","uuid":"df0eb380548d633a317f3b13c99c8f16","version":"1.4.0+build.8d7ab8b","vendor":{"version":"1.4.0+build.8d7ab8b","name":"The
Apache Software Foundation"}}
{code}
ddoc:
{code}
{
"_id": "_design/foo",
"_rev": "3-f7b8e13dcaf9fbe69a63d2717fbbba16",
"language": "javascript",
"views": {
"bar": {
"map": "function(doc) {\n emit(null, doc);\n}",
"reduce": "_foobar"
}
}
}
{code}
view call:
{code}
curl -v http://localhost:5984/apps/_design/foo/_view/bar
* Adding handle: conn: 0x1c67fa0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x1c67fa0) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 5984 (#0)
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 5984 (#0)
> GET /apps/_design/foo/_view/bar HTTP/1.1
> User-Agent: curl/7.30.0
> Host: localhost:5984
> Accept: */*
>
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server
{code}
crush log:
{code}
[Tue, 25 Jun 2013 20:38:26 GMT] [info] [<0.487.0>] Starting index update for
db: apps idx: _design/foo
[Tue, 25 Jun 2013 20:38:26 GMT] [error] [emulator] Error in process <0.733.0>
with exit value:
{function_clause,[{couch_query_servers,builtin_reduce,[reduce,[<<7
bytes>>],[[[null,<<32 bytes>>],{[{<<3 bytes>>,<<32 bytes>>},{<<4 bytes>>,<<34
bytes>>},{<<5 bytes>>,{[{<<6 bytes>>,null},{<<9 bytes>>,1365117683},{<<10
bytes>>,<<25 bytes>>},{<<10 bytes>>,<<25 bytes>>},{<<4 bytes>>,null},{<<4
bytes>>,<<9 bytes>>},{<<4 bytes>>,<<7 bytes>>}]}}]}],[[null,<<32
bytes>>],{[{<<3 bytes>>,<<32 bytes>>},{<<4 bytes>>,<<34 bytes>>},{<<5
bytes>>,{[{<<6 bytes>>,null},{<<9 bytes>>,1365117839},{<<10 bytes>>,<<25
bytes>>},{<<10 bytes>>,<<25 bytes>>},{<<4 bytes>>,null},{<<4 bytes>>,<<9
bytes>>},{<<4 bytes>>,<<7 bytes>>}]}}]}],[[null,<<32 bytes>>],{[{<<3
bytes>>,<<32 bytes>>},{<<4 bytes>>,<<34 bytes>>},{<<5 bytes>>,{[{<<6
bytes>>,null},{<<9 bytes>>,1365117844},{<<10 bytes>>,<<25 bytes>>},{<<10
bytes>>,<<25 bytes>>},{...
[Tue, 25 Jun 2013 20:38:26 GMT] [error] [<0.545.0>] {error_report,<0.31.0>,
{<0.545.0>,crash_report,
[[{initial_call,
{mochiweb_acceptor,init,
['Argument__1','Argument__2','Argument__3']}},
{pid,<0.545.0>},
{registered_name,[]},
{error_info,
{error,badarg,
[{erlang,list_to_binary,
[[{couch_query_servers,builtin_reduce,
[reduce,
[<<"_foobar">>],
[[[null,
<<"3f5046939ff05dec5d04747d6b0058c6">>],
{[{<<"_id">>,
<<"3f5046939ff05dec5d04747d6b0058c6">>},
{<<"_rev">>,
<<"1-93d47d1072a9b7c66c35b278eb8a9766">>},
{<<".meta">>,
{[{<<"author">>,null},
{<<"timestamp">>,1365117683},
{<<"created_at">>,
<<"2013-04-05T03:21:23+00:00">>},
{<<"updated_at">>,
<<"2013-04-05T03:21:23+00:00">>},
{<<"user">>,null},
{<<"peer">>,<<"127.0.0.1">>},
{<<"type">>,<<"generic">>}]}}]}],
[[null,
<<"3f5046939ff05dec5d04747d6b0061eb">>],
{[{<<"_id">>,
<<"3f5046939ff05dec5d04747d6b0061eb">>},
{<<"_rev">>,
<<"1-f6374d2b14f1e7164d596a3b030340b3">>},
{<<".meta">>,
{[{<<"author">>,null},
{<<"timestamp">>,1365117839},
{<<"created_at">>,
<<"2013-04-05T03:23:59+00:00">>},
{<<"updated_at">>,
<<"2013-04-05T03:23:59+00:00">>},
{<<"user">>,null},
{<<"peer">>,<<"127.0.0.1">>},
{<<"type">>,<<"generic">>}]}}]}],
[[null,
<<"3f5046939ff05dec5d04747d6b00640a">>],
{[{<<"_id">>,
<<"3f5046939ff05dec5d04747d6b00640a">>},
{<<"_rev">>,
<<"1-8ab18a0c2d7ddc2c8043f65ad7a79e45">>},
{<<".meta">>,
{[{<<"author">>,null},
{<<"timestamp">>,1365117844},
{<<"created_at">>,
<<"2013-04-05T03:24:04+00:00">>},
{<<"updated_at">>,
<<"2013-04-05T03:24:04+00:00">>},
{<<"user">>,null},
{<<"peer">>,<<"127.0.0.1">>},
{<<"type">>,<<"generic">>}]}}]}]],
[]],
[{file,"couch_query_servers.erl"},{line,168}]},
{couch_query_servers,reduce,3,
[{file,"couch_query_servers.erl"},{line,138}]},
{couch_mrview_util,'-open_view/5-fun-0-',4,
[{file,"src/couch_mrview_util.erl"},
{line,220}]},
{couch_btree,'-write_node/3-lc$^0/1-0-',5,
[{file,"couch_btree.erl"},{line,362}]},
{couch_btree,write_node,3,
[{file,"couch_btree.erl"},{line,356}]},
{couch_btree,modify_node,4,
[{file,"couch_btree.erl"},{line,325}]},
{couch_btree,query_modify,4,
[{file,"couch_btree.erl"},{line,196}]},
{couch_btree,add_remove,3,
[{file,"couch_btree.erl"},{line,174}]}]],
[]},
{couch_httpd,error_info,1,
[{file,"couch_httpd.erl"},{line,807}]},
{couch_httpd,send_error,2,
[{file,"couch_httpd.erl"},{line,912}]},
{couch_httpd,handle_request_int,5,
[{file,"couch_httpd.erl"},{line,365}]},
{mochiweb_http,headers,5,
[{file,"mochiweb_http.erl"},{line,94}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,239}]}]}},
{ancestors,
[couch_httpd,couch_secondary_services,
couch_server_sup,<0.32.0>]},
{messages,[]},
{links,[<0.103.0>,#Port<0.3508>]},
{dictionary,
[{mochiweb_request_qs,
[{"limit","11"},{"group","true"}]},
{couch_rewrite_count,0},
{mochiweb_request_cookie,
[{"m","34e2"},
{"AuthSession",
"Zm9vOjUxQzlGRjJFOteZB4p-DUsezYMVnW5KtCvYh6B2"}]}]},
{trap_exit,false},
{status,running},
{heap_size,28690},
{stack_size,27},
{reductions,10333}],
[]]}}
{code}
> CouchDB crushes for unknown builtin reduce function string
> ----------------------------------------------------------
>
> Key: COUCHDB-537
> URL: https://issues.apache.org/jira/browse/COUCHDB-537
> Project: CouchDB
> Issue Type: Bug
> Components: Database Core
> Affects Versions: 0.10
> Environment: ubuntu from source 0.10
> Reporter: greg tappero
> Attachments:
> 0001-Incorrect-builtin-function-names-now-throw-an-error-.patch,
> 0001-Incorrect-builtin-function-names-now-throw-an-error-.patch
>
>
> For a simple reduce as _sum if i add a space after _sum it crashes.
> Don't know how likely it is to add a space by mistake maybe the input could
> be trimed ?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira