Closed code4every1 closed 14 years ago
Seems that in src/couchdb/couch_spatial_updater.erl the process_result is not happy with a nil value
I just ran into the same problem.
idem
i fixed that in my repository :
http://github.com/benoitc/couchdb/commit/96bdd1caca75553be2ae7bfe93ef90abd1e78e56#diff-1
Thanks for the report. http://github.com/vmx/couchdb/commit/ea40322f863d3a76f6ff27f6e83cd75686b20938 should fix it.
Way to reproduce : curl -X PUT -d '{"noloc": [-122.270833, 37.804444]}' http://127.0.0.1:5984/places/nolocationdoc
curl -X GET 'http://localhost:5984/places/_design/main/_spatial/points?bbox=12,12,120,60' gives
{"error":"{function_clause,[{couch_spatial_updater,process_result,[[]]},\n {couch_spatial_updater,'-spatial_docs/2-fun-0-',1},\n {lists,map,2},\n {couch_spatial_updater,spatial_docs,2},\n {couch_spatial_updater,spatial_compute,2},\n {couch_spatial_updater,update,2}]}","reason":"{gen_server,call,[<0.27505.0>,{request_group,129},infinity]}"}
Whole stack trace
[Wed, 14 Jul 2010 08:53:33 GMT] [error] [emulator] Error in process <0.27147.0> with exit value: {function_clause,[{couch_spatial_updater,process_result,[[]]},{couch_spatial_updater,'-spatial_docs/2-fun-0-',1},{lists,map,2},{couch_spatial_updater,spatial_docs,2},{couch_spatial_updater,spatial_compute,2},{couch_spatial_updater...
[Wed, 14 Jul 2010 08:53:33 GMT] [error] [<0.27144.0>] * Generic server <0.27144.0> terminating * Last message in was {'EXIT',<0.27147.0>, {function_clause, [{couch_spatial_updater,process_result,[[]]}, {couch_spatial_updater, '-spatial_docs/2-fun-0-',1}, {lists,map,2}, {couch_spatial_updater,spatial_docs,2}, {couch_spatial_updater,spatial_compute,2}, {couch_spatial_updater,update,2}]}} \ When Server state == {group_state,<<"places">>, {"/opt/geocouch/var/lib/couchdb",<<"places">>, {spatial_group, <<241,169,54,19,209,26,68,252,255,120,95,151,101, 243,154,220>>, nil,nil,<<"_design/main">>,<<"javascript">>,[], [{spatial,nil,0,[],nil,nil,0, <<"function(doc) {\n if (doc.loc) {\n emit({\n type: \"Point\",\n coordinates: [doc.loc[0], doc.loc[1]]\n }, [doc._id, doc.loc]);\n }};">>, [<<"points">>]}], nil,0,0,nil}}, {spatial_group, <<241,169,54,19,209,26,68,252,255,120,95,151,101,243, 154,220>>, {db,<0.225.0>,<0.226.0>,nil,<<"1279031182139106">>, <0.24327.0>,<0.24329.0>, {db_header,5,129,0, {66901,{4,4}}, {67011,8}, nil,0,nil,nil,1000}, 129, {btree,<0.24327.0>, {66901,{4,4}},
Fun,
* Reason for termination == * {function_clause,[{couch_spatial_updater,process_result,[[]]}, {couch_spatial_updater,'-spatial_docs/2-fun-0-',1}, {lists,map,2}, {couch_spatial_updater,spatial_docs,2}, {couch_spatial_updater,spatial_compute,2}, {couch_spatial_updater,update,2}]}
[Wed, 14 Jul 2010 08:53:33 GMT] [error] [<0.27144.0>] {error_report,<0.30.0>, {<0.27144.0>,crash_report, [[{initial_call,{couch_spatial_group,init,['Argument__1']}}, {pid,<0.27144.0>}, {registered_name,[]}, {error_info, {exit, {function_clause, [{couch_spatial_updater,process_result,[[]]}, {couch_spatial_updater,'-spatial_docs/2-fun-0-',1}, {lists,map,2}, {couch_spatial_updater,spatial_docs,2}, {couch_spatial_updater,spatial_compute,2}, {couch_spatial_updater,update,2}]}, [{gen_server,terminate,6},{proc_lib,init_p_do_apply,3}]}}, {ancestors, [couch_spatial,couch_secondary_services,couch_server_sup,<0.31.0>]}, {messages,[]}, {links,[<0.27145.0>,<0.87.0>]}, {dictionary,[]}, {trap_exit,true}, {status,running}, {heap_size,610}, {stack_size,24}, {reductions,423}], []]}}
[Wed, 14 Jul 2010 08:53:33 GMT] [error] [<0.27145.0>] * Generic server <0.27145.0> terminating * Last message in was {'EXIT',<0.27144.0>, {function_clause, [{couch_spatial_updater,process_result,[[]]}, {couch_spatial_updater, '-spatial_docs/2-fun-0-',1}, {lists,map,2}, {couch_spatial_updater,spatial_docs,2}, {couch_spatial_updater,spatial_compute,2}, {couch_spatial_updater,update,2}]}} * When Server state == {file,{file_descriptor,prim_file,{#Port<0.3057>,131}}, 0} * Reason for termination == \ {function_clause,[{couch_spatial_updater,process_result,[[]]}, {couch_spatial_updater,'-spatial_docs/2-fun-0-',1}, {lists,map,2}, {couch_spatial_updater,spatial_docs,2}, {couch_spatial_updater,spatial_compute,2}, {couch_spatial_updater,update,2}]}
[Wed, 14 Jul 2010 08:53:33 GMT] [error] [<0.27145.0>] {error_report,<0.30.0>, {<0.27145.0>,crash_report, [[{initial_call,{couch_file,init,['Argument1']}}, {pid,<0.27145.0>}, {registered_name,[]}, {error_info, {exit, {function_clause, [{couch_spatial_updater,process_result,[[]]}, {couch_spatial_updater,'-spatial_docs/2-fun-0-',1}, {lists,map,2}, {couch_spatial_updater,spatial_docs,2}, {couch_spatial_updater,spatial_compute,2}, {couch_spatial_updater,update,2}]}, [{gen_server,terminate,6},{proc_lib,init_p_do_apply,3}]}}, {ancestors, [<0.27144.0>,couch_spatial,couch_secondary_services, couch_server_sup,<0.31.0>]}, {messages,[]}, {links,[#Port<0.3057>,<0.27148.0>]}, {dictionary,[]}, {trap_exit,true}, {status,running}, {heap_size,610}, {stack_size,24}, {reductions,1492}], [{neighbour, [{pid,<0.27148.0>}, {registered_name,[]}, {initial_call,{couch_ref_counter,init,['Argument1']}}, {current_function,{gen_server,loop,6}}, {ancestors, [<0.27144.0>,couch_spatial,couch_secondary_services, couch_server_sup,<0.31.0>]}, {messages, [{'DOWN',#Ref<0.0.0.149331>,process,<0.27144.0>, {function_clause, [{couch_spatial_updater,process_result,[[]]}, {couch_spatial_updater,'-spatial_docs/2-fun-0-',1}, {lists,map,2}, {couch_spatial_updater,spatial_docs,2}, {couch_spatial_updater,spatial_compute,2}, {couch_spatial_updater,update,2}]}}]}, {links,[<0.27145.0>]}, {dictionary,[]}, {trap_exit,false}, {status,runnable}, {heap_size,233}, {stack_size,9}, {reductions,47}]}]]}}
[Wed, 14 Jul 2010 08:53:33 GMT] [error] [<0.27122.0>] Uncaught error in HTTP request: {exit, {{function_clause, [{couch_spatial_updater,process_result, [[]]}, {couch_spatial_updater, '-spatial_docs/2-fun-0-',1}, {lists,map,2}, {couch_spatial_updater,spatial_docs,2}, {couch_spatial_updater,spatial_compute,2}, {couch_spatial_updater,update,2}]}, {gen_server,call, [<0.27144.0>, {request_group,129}, infinity]}}}
[Wed, 14 Jul 2010 08:53:33 GMT] [info] [<0.27122.0>] Stacktrace: [{gen_server,call,3}, {couch_spatial_group,request_group,2}, {couch_spatial,get_spatial_index,4}, {couch_httpd_spatial,handle_spatial_req,3}, {couch_httpd_db,do_db_req,2}, {couch_httpd,handle_request_int,5}, {mochiweb_http,headers,5}, {proc_lib,init_p_do_apply,3}]
[Wed, 14 Jul 2010 08:53:33 GMT] [info] [<0.27122.0>] 127.0.0.1 - - 'GET' /places/_design/main/_spatial/points?bbox=12,12,120,60 500