While working on a nodejs application with riak / riak-js, I encountered the following issue:
Executing this request
db.mapreduce
.add('logs')
.run();
successfully retrieves all 155.000 items stored in the bucket logs along with their IDs:
[ 'logs', '1GXtBX2LvXpcPeeR89IuipRUFmB' ],
[ 'logs', '63vL86NZ96JptsHifW8JDgRjiCv' ],
[ 'logs', 'NfseTamulBjwVOenbeWoMSNRZnr' ],
[ 'logs', 'VzNouzHc7B7bSzvNeI1xoQ5ih8J' ],
[ 'logs', 'UBM1IDcbZkMW4iRWdvo4W7zp6dc' ],
[ 'logs', 'FtNhPxaay4XI9qfh4Cf9LFO1Oai' ],
....
If I provide a map function and only select a few items from the bucket logs
db.mapreduce
.add([['logs', 'SUgJ2fhfgyR2WE87n7IVHyBi4C9'], ['logs', 'EMtywD1UFnsq9rNRuINLzDsHdh2'], ['logs', 'ZXPh5ws8mOdASQFEtLDk8CBRn8t']])
.map( function(v) {return ["asd"]; } )
.run();
everything works fine and the expected output is returned as follows:
[ 'asd', 'asd', 'asd' ]
However, if I try to map all items (approximately 155.000 small JSON documents) in the "logs" bucket using:
db.mapreduce
.add('logs')
.map( function(v) {return ["asd"]; } )
.run();
I only receive errors:
{ [Error: [object Object]] message: '[object Object]', statusCode: 500 }
What could be causing this error? The Error object doesn't provide any useful information.
Update: The Riak console displays the following error multiple times:
[notice] JS call failed: All VMs are busy.
After increasing map_js_vm_count in Riak's app.config to 36, the error changes to:
[error] Pipe worker startup failed: fitting was gone before startup
For more information, visit: Basho Labs Riak Driver riak-js