[SERVER-68196] Memory usage for BoundedSorter is invalid when sorting then grouping. Created: 21/Jul/22  Updated: 29/Oct/23  Resolved: 28/Jul/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 6.0.0-rc13
Fix Version/s: 6.0.1, 6.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Shlomo Shriki Assignee: Dan Larkin-York
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-68297 Document::memUsageForSorter returns a... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v6.0
Sprint: Execution Team 2022-08-08
Participants:

 Description   

db.airQuality.aggregate([
{
'$match': {
'metadata.sensorId': {
'$in': [ 's-test-airQuality-3', 's-test-airQuality-7', 's-test-airQuality-10', 's-test-airQuality-4', 's-test-airQuality-8', 's-test-airQuality-2', 's-test-airQuality-9', 's-test-airQuality-11', 's-test-airQuality-6', 's-test-airQuality-5' ]
},
systemTime: {
'$gt': ISODate('2022-07-20T15:31:49.854Z'),
'$lt': ISODate('2022-07-21T03:31:49.854Z')
}
}
},
{
'$sort': { systemTime: -1 }
},
{
'$group': {
_id: '$metadata.sensorId',
doc: { '$first': '$$ROOT' }
}
}, {
'$replaceRoot': { newRoot: '$doc' }
}
])
 
Exection of the above results in:
MongoError: PlanExecutor error during aggregation :: caused by :: Memory usage for BoundedSorter is invalid

This only started happening after atlas auto upgraded our cluster to use mongodb 6.0.0.


The match step returns just under 400 documents that look like this:

{

"systemTime": {
"$date": "2022-03-26T02:21:35.030Z"
},
"metadata": {
"ns": "test",
"sensorId": "s-test-airQuality-6"
},
"pm25ConcMass": 4.92,
"_id": {
"$oid": "629011a313aa1022fcabe391"
},
"createdAt": {
"$date": "2022-05-26T23:47:47.786Z"
},
"pm25Aqi": 20,
"longitude": -90.199122,
"NO2Aqi": 42,
"latitude": 29.114455,
"NO2Conc": 6.71,
"pm25ConcNum": 6.31,
"pm10Aqi": 5,
"pm1ConcMass": 2.58,
"pm10ConcMass": 5.15,
"pm1ConcNum": 6.1,
"pm10ConcNum": 6.37
{color:#657b83}}



 Comments   
Comment by Kelsey Schubert [ 08/Aug/22 ]

I'd say within the next couple weeks or so.

Comment by Shlomo Shriki [ 03/Aug/22 ]

Hey! I see this has been addressed, thank you!

Is there any estimate on when I'll be able to use the fixed version in mongo atlas?

Comment by Githook User [ 28/Jul/22 ]

Author:

{'name': 'Dan Larkin-York', 'email': 'dan.larkin-york@mongodb.com', 'username': 'dhly-etc'}

Message: SERVER-68196 Fix broken assertion in BoundedSorter
Branch: master
https://github.com/mongodb/mongo/commit/32f0c6de29703f610142b52a9524ed22cf41d8b4

Comment by Kelsey Schubert [ 21/Jul/22 ]

Thanks for the report, syshriki@yahoo.com. We're investigating.

Comment by Shlomo Shriki [ 21/Jul/22 ]

I'm also seeing this happen when the sort step is followed by a projection step.

Comment by Shlomo Shriki [ 21/Jul/22 ]

forgot to mention, this collection is a timeseries collection.

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