[SERVER-42275] mongod crashes after combining sort with hint in v2.5.4 Created: 18/Jul/19  Updated: 06/Dec/22  Resolved: 22/Jul/19

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

Type: Bug Priority: Major - P3
Reporter: João Agnelo Assignee: Backlog - Triage Team
Resolution: Incomplete Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Triage
Operating System: ALL
Steps To Reproduce:

(using the USA cities database)

db = db.getMongo().getDB("usa");

db.cities.ensureIndex({city: -1, pop: -1, state: -1});

cursor = db.cities.find({id: '05356'}).hint("city-1_pop_-1_state_-1").sort({_id: -1}).limit(100);

cursor_explain = cursor.explain();
cursor_count = cursor.count();
cursor_size = cursor.size();

db.getSisterDB("results")[TEST_NAME + ".explain"].insert({explain: tojson(cursor_explain)});

cursor.forEach(function(doc) {db.getSisterDB("results")[TEST_NAME].insert(doc);});

Participants:

 Description   

While performing an academic experiment based on the random generation of a large set of tests to exercise the Query Language of MongoDB (all of which syntactically valid), a possible bug was detected in one specific test that executes a query (find()), provides a hint() and sort()'s its results.

The same query was executed without sort() or hint() and was successful (i.e., only find()), with find().hint() and was also successful, with find().sort() an error is thrown in the assertion at line 1014 in query_planner.cpp, and with find().hint().sort() the mongod service crashes unexpectedly.



 Comments   
Comment by Danny Hatcher (Inactive) [ 22/Jul/19 ]

Due to the old age of this version of MongoDB, I'm going to close this ticket. Please re-open if you are able to reproduce against a modern version.

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