basho/riak_kv — Issue #286: Failed JS MR includes Erlang terms
Author: rzezeski
Created: 2012-02-14 23:09:32+00:00
State: open
Labels: Bug, MapReduce

When performing a JS MR job against master (commit `8fe7e1ec9434a616d656c400bd51423f69590f37`) that results in an error, strings containing Erlang terms are returned inside the object. I produced this error manually running the `badMap` test case found in the riak-javascript-client (1).

1. Stand up an instance of Riak

2. Checkout riak-javascript-client

3. `cd riak-javascript-client/tests`

4. `./setup -i` (you may need to modify the setup script to point to correct port/host)

5. Finally, run the following curl

curl -XPOST http://10.0.1.4:8098/mapred -d '{"inputs":"mr_test", "query":[{"map":{"language":"javascript","source":"function(value) { return [JSON.parse(value)]; }", "keep":true}}], "timeout":60000}'

Below is a copy of my output

## 1.0.3

$ curl -XPOST http://10.0.1.4:8098/mapred -d '{"inputs":"mr_test", "query":[{"map":{"language":"javascript","source":"function(value) { return [JSON.parse(value)]; }", "keep":true}}], "timeout":60000}' | jsonpp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 210 100 56 100 154 2365 6506 --:--:-- --:--:-- --:--:-- 8105
{
"lineno": 477,
"message": "JSON.parse",
"source": "unknown"
}

## Master

$ curl -XPOST http://10.0.1.4:8098/mapred -d '{"inputs":"mr_test", "query":[{"map":{"language":"javascript","source":"function(value) { return [JSON.parse(value)]; }", "keep":true}}], "timeout":60000}' | jsonpp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 808 100 654 100 154 63513 14955 --:--:-- --:--:-- --:--:-- 106k
{
"phase": 0,
"error": "[{<<\"lineno\">>,477},{<<\"message\">>,<<\"JSON.parse\">>},{<<\"source\">>,<<\"unknown\">>}]",
"input": "{ok,{r_object,<<\"mr_test\">>,<<\"third\">>,[{r_content,{dict,6,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[[<<\"Links\">>]],[],[],[],[],[],[],[],[[<<\"content-type\">>,116,101,120,116,47,112,108,97,105,110],[<<\"X-Riak-VTag\">>,49,117,106,81,100,85,75,113,105,88,119,84,49,86,99,55,121,121,67,55,85,53]],[[<<\"index\">>]],[],[[<<\"X-Riak-Last-Modified\">>|{1329,256793,914740}]],[],[[<<\"X-Riak-Meta\">>]]}}},<<\"1\">>}],[{<<35,9,254,249,79,57,154,63>>,{3,63496475993}}],{dict,1,16,16,...},...},...}"
}

(1) https://github.com/basho/riak-javascript-client/blob/slf-sigsegv-bug/tests/unit_tests.js#L313