[SERVER-22334] mongod crashes on map_reduce call at AdjustAmountOfExternalAllocatedMemory Created: 28/Jan/16  Updated: 29/Jan/16  Resolved: 29/Jan/16

Status: Closed
Project: Core Server
Component/s: Admin
Affects Version/s: 3.0.8
Fix Version/s: None

Type: Bug Priority: Critical - P2
Reporter: Peter Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File crash-mongo.py     Text File mongod-crash.txt    
Operating System: ALL
Steps To Reproduce:

We just need to run attached script on our replica set.

Participants:

 Description   

We have replica set with 3 mongod nodes. After we call crash-mongo.py (attached) script two of nodes (SECONDARY) fall with the backtrace (see mongod-crash.txt attached).



 Comments   
Comment by Ramon Fernandez Marina [ 29/Jan/16 ]

Thanks for the feedback pva, and glad to hear that 3.2.1 solves this issue for you.

Regards,
Ramón.

Comment by Peter [ 29/Jan/16 ]

I'm not sure how to update status of this issue, but I hope you'll see my comment.

Comment by Peter [ 29/Jan/16 ]

Thank you guys for fast feedback.

1. We use Gentoo distribution everywhere, so binaries are self built, of course.
2. Upgrade to 3.2.1 helped. Actually after upgrade this script started to issue error:

Traceback (most recent call last):
  File "crash-mongo.py", line 26, in <module>
    result = db.sms.map_reduce(map, reduce,"sms_report", query={'charging_id': {'$ne':10}, 'receipt.stat': 'DELIVRD'})
  File "/usr/lib64/python3.4/site-packages/pymongo/collection.py", line 1621, in map_reduce
    sock_info, cmd, slave_ok, ReadPreference.PRIMARY)
  File "/usr/lib64/python3.4/site-packages/pymongo/collection.py", line 191, in _command
    allowable_errors)
  File "/usr/lib64/python3.4/site-packages/pymongo/pool.py", line 184, in command
    codec_options, check, allowable_errors)
  File "/usr/lib64/python3.4/site-packages/pymongo/network.py", line 54, in command
    helpers._check_command_response(response_doc, msg, allowable_errors)
  File "/usr/lib64/python3.4/site-packages/pymongo/helpers.py", line 188, in _check_command_response
    raise OperationFailure(msg % errmsg, code, response)
pymongo.errors.OperationFailure: command SON([('mapreduce', 'sms'), ('map', Code('\n    function(){\n        emit(this.addr, this)\n    }\n', {})), ('reduce', Code("\n    function(key, values){\n         var result = {'addr': key, 'sent':[]}\n         for (var i = 0; i < values.length; i++) {\n            result.sent.append(value)\n         }\n         return result\n    }\n", {})), ('out', 'sms_report'), ('query', {'receipt.stat': 'DELIVRD', 'charging_id': {'$ne': 10}})]) on namespace atv-purchase.$cmd failed: ReferenceError: value is not defined :
_funcs2@:5:13

My guess is that crash was due to this error, and this error was as result was not defined with var. It should be 'var result = ...' instead of 'result = ...'

So this error is resolved in 3.2.х. Thank you again!

Comment by Ramon Fernandez Marina [ 28/Jan/16 ]

Note also that MongoDB 3.2 uses SpiderMonkey as the JavaScript engine, so I'd recommend you try the latest version (3.2.1 at the moment) and see if meets your needs.

Comment by Ramon Fernandez Marina [ 28/Jan/16 ]

Hi pva, the crash is happening inside the V8 engine. We've seen this before in systems with grsecurity/SELinux, as well as with custom compiled binaries.

Does your system have any grsecurity/SELinux policies enabled? Are you using stock binaries or were these binaries compiled in-house?

Thanks,
Ramón.

Generated at Thu Feb 08 04:00:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.