[SERVER-5001] mapreduce job asserts with inline output, but works with other output options Created: 17/Feb/12  Updated: 10/Dec/14  Resolved: 26/Jun/14

Status: Closed
Project: Core Server
Component/s: MapReduce
Affects Version/s: 2.0.2
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Daniel Pasette (Inactive) Assignee: Ramon Fernandez Marina
Resolution: Cannot Reproduce Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Operating System: ALL
Participants:

 Description   

Taken from FREE-7095:

rtb@mon-raw> map = function () { 
...     emit(this.geo.country,{count:1}); 
... } 
function () { 
    emit(this.geo.country, {count:1}); 
} 
 
rtb@mon-raw> reduce = function (key, values) { 
...     var result = {count:0}; 
...     values.forEach(function(doc) { 
...        result.count += doc.count; 
...     }); 
...   return result; 
... } 
function (key, values) { 
    var result = {count:0}; 
    values.forEach(function (doc) {result.count += doc.count;}); 
    return result; 
} 
 
rtb@mon-raw> db.request.mapReduce(map, 
...                      reduce, 
...                      {query:{"created.simple": 
{$gte:"20120207192900",$lt:"20120207193000"}}, 
...                       out:"test_coll"}) 
{ 
        "result" : "test_coll", 
        "timeMillis" : 12494, 
        "counts" : { 
                "input" : 4229, 
                "emit" : 4229, 
                "reduce" : 133, 
                "output" : 62 
        }, 
        "ok" : 1, 
} 
 
rtb@mon-raw> db.request.mapReduce(map, 
...                      reduce, 
...                      {query:{"created.simple": 
{$gte:"20120207192900",$lt:"20120207193000"}}, 
...                       out:{inline:1}}) 
Thu Feb 16 16:43:46 uncaught exception: map reduce failed:{ 
        "assertion" : "assertion db/commands/mr.cpp:400", 
        "errmsg" : "db assertion failure", 
        "ok" : 0 
} 



 Comments   
Comment by Ramon Fernandez Marina [ 26/Jun/14 ]

Since we haven't heard back from anyone that can upload a reproducer I'm going to mark this ticket as resolved. If someone has a reproducer we can use, feel free to re-open the ticket so we can investigate further.

Regards,
Ramón.

Comment by Ramon Fernandez Marina [ 05/Jun/14 ]

It appears that nobody at MongoDB has been able to reproduce this ticket yet. If someone could upload a sample document and a script that reproduces the problem that would be very useful in our efforts to get to the bottom of this.

Thanks,
Ramón.

Comment by Tomas Henriquez [ 19/Jun/13 ]

I was able to reproduce the error, when doing a map/reduce with a key value that has some values = null, it throws this problem.

I fix it adding an if statement to the map function, something like this:

if(!this.my_key)

{ return; }

Now I am not sure if it should be treated as a bug or a programming error. If it's treated as a programming error, some kind of warning would be great.

Comment by Andrew Emil (Inactive) [ 30/May/13 ]

Just as commentary, I have tried and failed to repro this. My attempt:

> map = function() { emit(null, 1) }
function () { emit(null, 1) }
> reduce = function(key, values) { var result = {count : 0}; values.forEach(function() { result.count = result.count + 1 }); return result }
function (key, values) { var result = {count : 0}; values.forEach(function() { result.count = result.count + 1 }); return result }
> db.test.mapReduce(map, reduce, { out : "testout" })
{
	"result" : "testout",
	"timeMillis" : 132,
	"counts" : {
		"input" : 10008,
		"emit" : 10008,
		"reduce" : 101,
		"output" : 1
	},
	"ok" : 1,
}
> db.test.mapReduce(map, reduce, { out : {inline : 1}})
{
	"results" : [
		{
			"_id" : null,
			"value" : {
				"count" : 9
			}
		}
	],
	"timeMillis" : 91,
	"counts" : {
		"input" : 10008,
		"emit" : 10008,
		"reduce" : 101,
		"output" : 1
	},
	"ok" : 1,
}

If anybody could upload something similar that breaks, in addition to showing a sample document you are running over and noting the version it breaks in, that would be very useful to me.

Comment by Timothy Kettering [ 21/May/13 ]

I have run into this issue just today with mongo 2.4.3. like christian csar explained above = it was a coding error where i emitted a invalid key (that was null) and caused inline:1 to fail with the cpp error. changing the out option to a collection, worked fine.

fixing the coding error and emitting a valid key, both inline and collection output worked fine.

Comment by Eliot Horowitz (Inactive) [ 23/Apr/13 ]

Can anyone attach a script that does this? We seem to be having trouble reproducing.

Comment by Christian Csar [ 29/Aug/12 ]

If you are still looking to reproduce this I'm seeing this behavior in 2.0.6. Due to a coding error in my map function I was emitting null as the key for all documents. When outputting to an inline collection I received the above assert; however, when simply using

{replace : "outputCollection1"}

instead of

{inline: 1}

led to the correct output in outputCollection1 (correct given my coding errors that is).

{
"result" : "outputCollection1",
"timeMillis" : 720,
"counts" :

{ "input" : 2, "emit" : 2, "reduce" : 1, "output" : 1 }

,
"ok" : 1,
}

Let me know if I can be of further assistance.

Comment by Antoine Girbal [ 30/Apr/12 ]

no more comment on this?
Cannot reproduce but seems to have several reports of this, where assertion is throw if key is null with inline mode.
Should not be too difficult to find bug from code.

Comment by Antoine Girbal [ 23/Mar/12 ]

I cannot reproduce this with 2.0.2..
I tried MR that emits some null keys and some valid keys, and everything gets properly reduce with no error in inline mode.
Could you post the workaround you implemented and sample of data with null key?

Comment by Antoine Girbal [ 21/Feb/12 ]

I would need more information in order to reproduce this.
It seems to happen on an assert where there is more than 1 value for a key, even after the final reduce.

1. does it happen every time you run with "inline"?
2. is it emitting any null key?
3. I see there are only 62 docs in the output, could you attach a dump of the result collection?

thanks

Comment by Jonathan Tushman [ 20/Feb/12 ]

I am having this same issue. Is there a work around until this is fixed? Thanks!

Generated at Thu Feb 08 03:07:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.