[SERVER-52959] Fix invariant failure in IndexScanStage::doRestoreState() Created: 20/Nov/20  Updated: 24/Apr/21  Resolved: 25/Nov/20

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

Type: Bug Priority: Major - P3
Reporter: Drew Paroski Assignee: David Storch
Resolution: Duplicate Votes: 0
Labels: qexec-team
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-51655 Investigate sys-perf benchmark perfor... Closed
Duplicate
duplicates SERVER-52678 [SBE] multi-planner candidate plan ma... Closed
Operating System: ALL
Steps To Reproduce:

 

# Launch mongod:
~/mongo/build/install/bin/mongod
 
# Download the dataset and load it into mongo:
mkdir ~/bestbuy-dataset
cd ~/bestbuy-dataset
wget https://s3-us-west-2.amazonaws.com/dsi-donot-remove/AggPerformance/bestbuyproducts.bson.gz
mongorestore --gzip --archive=bestbuyproducts.bson.gz
 
# Run the following commands in the mongo shell:
> db.adminCommand({setParameter:1, internalQueryEnableSlotBasedExecutionEngine:true});
> use bestbuy;
> db.products.find({type: "Music"}).skip(1000).limit(1)

 

 

Sprint: Query 2020-11-30
Participants:

 Description   

When I tried to run the "bestbuy_agg_query_comparison.js" benchmark with useAgg=false and with SBE mode enabled, the benchmark failed with mongod crashing due to an invariant failure in IndexScanStage::doRestoreState().

I've developed a simplified repro - see the "Steps To Reproduce" section.

The invariant failure is happening on line 133 of "src/mongo/db/exec/sbe/stages/ix_scan.cpp":

invariant(_opCtx);

Here is what the call stack looks like when the invariant fails:

 mongo::sbe::IndexScanStage::doRestoreState()
 mongo::sbe::CanChangeState<mongo::sbe::PlanStage>::restoreState()
 mongo::sbe::CanChangeState<mongo::sbe::PlanStage>::restoreState()
 mongo::sbe::CanChangeState<mongo::sbe::PlanStage>::restoreState()
 mongo::PlanYieldPolicySBE::yield(mongo::OperationContext*, std::function<void ()>)
 mongo::PlanYieldPolicy::yieldOrInterrupt(mongo::OperationContext*, std::function<void ()>)
 mongo::sbe::IndexScanStage::getNext()
 mongo::sbe::LoopJoinStage::getNext()
 mongo::sbe::LimitSkipStage::open(bool)
 mongo::sbe::LoopJoinStage::open(bool)
 mongo::sbe::LimitSkipStage::open(bool)
 mongo::sbe::BaseRuntimePlanner::prepareExecutionPlan(mongo::sbe::PlanStage*, mongo::stage_builder::PlanStageData*) const

 

 

The goal of this task is to investigate why the invariant is failing and fix the underlying issue.



 Comments   
Comment by David Storch [ 25/Nov/20 ]

Closing as a duplicate of SERVER-52678. I have confirmed that my fix for SERVER-52678 also fixes Drew's repro in this ticket.

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