-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Query Execution
-
None
-
Fully Compatible
-
ALL
-
-
Query Execution 2021-05-03, Query Execution 2021-05-17
This was a result of an aggregation_expression_multiversion_fuzzer run here.
The pipeline that caused the failure was
{"$project":{"a":{"$add":[{"$numberDecimal":"236.27711376769366"},{"$date":"2019-01-30T07:30:10.137Z"},93369,"$obj.obj.obj.num"]},"_id":0}} // 63
And the offending document was
{_id: 795, "str": "Generic Cotton", "num": NumberLong("59052"), "date": new Date("2019-10-23T11:18:26.197Z"), "array": ["hacking Trail", new Date("2019-09-28T08:32:07.826Z"), {_id: 796, "str": "Gloves", "num": NumberInt(38192), "date": new Date("2019-06-17T13:26:06.579Z"), "array": [], "obj": {_id: 797, "str": "Rubber Executive synthesizing", "num": NumberLong("3345"), "array": [new Date("2019-02-12T08:50:16.240Z"), "full-range", NaN], }, }, NumberLong("58726"), {_id: 798, "str": "Grove Minnesota", "obj": {}, }, ["Soft overriding Credit Card Account", new Date("2019-06-11T21:54:58.779Z"), new Date("2019-11-15T07:02:19.029Z")], NumberLong("43776"), {_id: 799, "num": NumberDecimal("556.1485031177453"), "date": new Date("2019-01-31T02:54:44.487Z"), "array": [NaN, new Date("2019-07-13T20:56:58.610Z"), NumberInt(87918)], }, [NumberLong("27821"), "Baht olive"], NumberDecimal("103.72360506453242")], "obj": {_id: 800, "num": NumberInt(98410), "array": null, "obj": {_id: 801, "date": new Date("2019-10-14T06:31:08.955Z"), "obj": {_id: 802, "str": null, "num": NumberDecimal("819.5359123621083"), "date": new Date("2019-04-26T02:33:00.523Z"), "array": [], }, }, }, }, // 136
The invariant tripped in the logs
Error "Invariant failure","attr":{"expr":"Hit a MONGO_UNREACHABLE!","file":"src/mongo/db/exec/sbe/values/value.h","line":1125} "About to run the command","attr":{"db":"fuzzer","commandArgs":{"aggregate":"fuzzer_coll","pipeline":[{"$project":{"a":{"$add":[{"$numberDecimal":"236.27711376769366"},{"$date":"2019-01-30T07:30:10.137Z"},93369,"$obj.obj.obj.num"]},"_id":0}}],"maxTimeMS":30000,"collation":{"locale":"el","strength":1},"apiVersion":"1","cursor":{},"lsid":{"id":{"$uuid":"dce47dbf-436c-4638-90ed-0a42401e5d29"}},"$db":"fuzzer"}} "Invariant failure","attr":{"expr":"Hit a MONGO_UNREACHABLE!","file":"src/mongo/db/exec/sbe/values/value.h","line":1125} "\n\n***aborting after invariant() failure\n\n" "Writing fatal message","attr":{"message":"Got signal: 6 (Aborted).\n"}
Possible Cause:
We handle this case correctly if $add is evaluated using the doubleDoubleSum() builtin. However, there is constant folding going on for this query and $add is executed using genericArithemticOp<Addition> which is trying to compute addition of a NumberDecimal and a Date. The MONGO_UNREACHABLE case is being hit when trying to cast a NumberDecimal to a long and it can't do that because of the std::is_same_v check.
In the classic engine, we track decimal addition in 'decimalTotal' in a Decimal128 variable and then do decimal to long conversions at the end with a rounding scheme.
- is depended on by
-
SERVER-52799 Make sbe the default execution engine and switch "SBE" build variant to "SBE off"
- Closed
- is duplicated by
-
SERVER-56391 Implement date overflow check in SBE
- Closed
-
SERVER-56467 [SBE] MONGO_UNREACHABLE in src/mongo/db/exec/sbe/values/value.h
- Closed
- is related to
-
SERVER-56593 Unexpected tie-breaking behavior in DoubleDoubleSummation::getLong()
- Backlog