I'm trying to run a map/reduce query and running into strange errors. I can't 
figure out how to determine the cause of the error I'm receiving.

I'm basically getting this same error with any map/reduce query to any existing 
bucket. I found that the simplest query that demonstrates the problem clearly 
and that my sanity check says should work every time is to just use 
Riak.mapValuesJson, but even if I provide my own map function that just returns 
nothing I still get the exact same error. If I run the same query but list a 
non-existing bucket in inputs, I get back the expected "[]".

I'm using erlang and riak both installed on OSX via homebrew and both upgraded 
within the last couple weeks to the latest versions.

The query:
curl -X POST http://localhost:8098/mapred -H 'Content-Type: application/json' 
-d 
'{"inputs":"testfs","query":[{"map":{"language":"javascript","name":"Riak.mapValuesJson","keep":true}}]}'

The result:
<html><head><title>500 Internal Server Error</title></head><body><h1>Internal 
Server Error</h1>The server encountered an error while processing this 
request:<br><pre>{error,
    {error,
        {case_clause,
            {error,
                {0,
                 [{module,riak_kv_mrc_map},
                  {partition,319703483166135013357056057156686910549735243776},
                  {details,
                      [{fitting,
                           {fitting,<0.23063.0>,#Ref<0.0.1.197095>,follow,1}},
                       {name,0},
                       {module,riak_kv_mrc_map},
                       {arg,{{jsfun,<<"Riak.mapValuesJson">>},none}},
                       {output,
                           {fitting,<0.23061.0>,#Ref<0.0.1.197095>,sink,
                               undefined}},
                       {options,
                           [{log,sink},
                            {trace,[error]},
                            {sink,
                                {fitting,<0.23061.0>,#Ref<0.0.1.197095>,sink,
                                    undefined}},
                            {sink_type,{fsm,10,infinity}}]},
                       {q_limit,64}]},
                  {type,error},
                  {error,badarg},
                  {input,
                      {ok,{r_object,<<"testfs">>,<<"__fs_root">>,
                              [{r_content,
                                   {dict,6,16,16,8,80,48,
                                       {[],[],[],[],[],[],[],[],[],[],[],[],
                                        [],[],[],[]},
                                       {{[],[],
                                         [[<<"Links">>,
                                           {{<<"testfs">>,<<"__fs_info">>},
                                            <<"parent">>}]],
                                         [],[],[],[],[],[],[],
                                         [[<<"content-type">>,97,112,112,108,
                                           105,99,97,116,105,111,110,47,106,
                                           115,111,110],
                                          [<<"X-Riak-VTag">>,77,122,49,89,105,
                                           49,56,90,70,51,109,97,68,110,105,
                                           52,86,97,84,49]],
                                         [[<<"index">>]],
                                         [],
                                         [[<<"X-Riak-Last-Modified">>|
                                           {1379,469049,229403}]],
                                         [],
                                         [[<<"X-Riak-Meta">>,
                                           {<<"type">>,<<"directory">>}]]}}},
                                   <<"{\"items\": {\"one": null, \"two": null}, 
\"status\": {\"time\": 1379469049, \"size\": 0}}">>}],
                              [{<<"#\t??Q?2~">>,{1,63546688249}}],
                              {dict,1,16,16,8,80,48,
                                  {[],[],[],[],[],[],[],[],[],[],[],[],[],[],
                                   [],[]},
                                  {{[],[],[],[],[],[],[],[],[],[],[],[],[],[],
                                    [[clean|true]],
                                    []}}},
                              undefined},
                          undefined}},
                  {modstate,
                      {state,
                          319703483166135013357056057156686910549735243776,
                          {fitting_details,
                              {fitting,<0.23063.0>,#Ref<0.0.1.197095>,follow,
                                  1},
                              0,riak_kv_mrc_map,
                              {{jsfun,<<"Riak.mapValuesJson">>},none},
                              {fitting,<0.23061.0>,#Ref<0.0.1.197095>,sink,
                                  undefined},
                              [{log,sink},
                               {trace,[error]},
                               {sink,
                                   {fitting,<0.23061.0>,#Ref<0.0.1.197095>,
                                       sink,undefined}},
                               {sink_type,{fsm,10,infinity}}],
                              64},
                          {jsfun,<<"Riak.mapValuesJson">>},
                          none}},
                  {stack,
                      [{erlang,localtime_to_universaltime,
                           [{{2013,9,18},{9,50,49}},true],
                           []},
                       {calendar,local_time_to_universal_time_dst,1,
                           [{file,"calendar.erl"},{line,282}]},
                       {httpd_util,rfc1123_date,1,
                           [{file,"httpd_util.erl"},{line,344}]},
                       {riak_object,'-jsonify_metadata/1-fun-0-',1,
                           [{file,"src/riak_object.erl"},{line,452}]},
                       {lists,map,2,[{file,"lists.erl"},{line,1173}]},
                       {lists,map,2,[{file,"lists.erl"},{line,1173}]},
                       {riak_object,jsonify_metadata,1,
                           [{file,"src/riak_object.erl"},{line,464}]},
                       {riak_object,'-to_json/1-lc$^0/1-0-',1,
                           [{file,"src/riak_object.erl"},{line,430}]}]}]}}},
        [{riak_kv_wm_mapred,pipe_mapred_nonchunked,3,
             [{file,"src/riak_kv_wm_mapred.erl"},{line,180}]},
         {webmachine_resource,resource_call,3,
             [{file,"src/webmachine_resource.erl"},{line,186}]},
         {webmachine_resource,do,3,
             [{file,"src/webmachine_resource.erl"},{line,142}]},
         {webmachine_decision_core,resource_call,1,
             [{file,"src/webmachine_decision_core.erl"},{line,48}]},
         {webmachine_decision_core,decision,1,
             [{file,"src/webmachine_decision_core.erl"},{line,487}]},
         {webmachine_decision_core,handle_request,2,
             [{file,"src/webmachine_decision_core.erl"},{line,33}]},
         {webmachine_mochiweb,loop,2,
             [{file,"src/webmachine_mochiweb.erl"},{line,71}]},
         {mochiweb_http,parse_headers,5,
             
[{file,"src/mochiweb_http.erl"},{line,180}]}]}}</pre><P><HR><ADDRESS>mochiweb+webmachine
 web server</ADDRESS></body></html>

Thanks for any insight into how to figure this one out :)

jeff
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to