[SERVER-25039] Aggregation can attempt to re-plan after collection has been dropped Created: 13/Jul/16  Updated: 21/Nov/16  Resolved: 25/Jul/16

Status: Closed
Project: Core Server
Component/s: Aggregation Framework, Querying
Affects Version/s: None
Fix Version/s: 3.2.10, 3.3.11

Type: Bug Priority: Major - P3
Reporter: Charlie Swanson Assignee: Max Hirschhorn
Resolution: Done Votes: 0
Labels: code-and-test
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-24761 Queries being planned with the subpla... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Sprint: Query 18 (08/05/16)
Participants:

 Description   

When attempting to establish the PlanExecutor to feed the pipeline, we undergo query planning, which can yield. During a yield, the collection can be dropped, and leave us with an invalid collection pointer. Specifically, if the planning fails on this line, then we will ignore the failure and try again on this line, at which point collection is an invalid pointer to a collection that doesn't exist anymore.

For future reference, if this issue is hit, the backtrace should look something like this:

[MongoDFixture:job0] 2016-11-07T18:09:36.067-0500 I COMMAND  [conn31] CMD: drop db0.kill_aggregation
[MongoDFixture:job0] 2016-11-07T18:09:36.089-0500 F -        [conn35] Got signal: 11 (Segmentation fault).
[MongoDFixture:job0] 
[MongoDFixture:job0]  0x1307192 0x13060b9 0x1306438 0x7f10fde2c3e0 0xdf8124 0xdf3048 0xdf58a3 0xdc9ba4 0xdc9f08 0xdcb7b4 0xda20dc 0xda279a 0xda3572 0xb313e0 0xb84903 0xb85794 0xadc1f0 0xc9dcb5 0x96441c 0x12c1465 0x7f10fde2270a 0x7f10fdb5882d
[MongoDFixture:job0] ----- BEGIN BACKTRACE -----
[MongoDFixture:job0] {"backtrace":[{"b":"400000","o":"F07192","s":"_ZN5mongo15printStackTraceERSo"},{"b":"400000","o":"F060B9"},{"b":"400000","o":"F06438"},{"b":"7F10FDE1B000","o":"113E0"},{"b":"400000","o":"9F8124","s":"_ZNK5mongo26PlanCacheIndexabilityState17getDiscriminatorsENS_10StringDataE"},{"b":"400000","o":"9F3048","s":"_ZNK5mongo9PlanCache17encodeKeyForMatchEPKNS_15MatchExpressionEPNS_17StringBuilderImplINS_16TrivialAllocatorEEE"},{"b":"400000","o":"9F58A3","s":"_ZNK5mongo9PlanCache10computeKeyERKNS_14CanonicalQueryE"},{"b":"400000","o":"9C9BA4","s":"_ZN5mongo20fillOutPlannerParamsEPNS_16OperationContextEPNS_10CollectionEPNS_14CanonicalQueryEPNS_18QueryPlannerParamsE"},{"b":"400000","o":"9C9F08"},{"b":"400000","o":"9CB7B4","s":"_ZN5mongo11getExecutorEPNS_16OperationContextEPNS_10CollectionESt10unique_ptrINS_14CanonicalQueryESt14default_deleteIS5_EENS_12PlanExecutor11YieldPolicyEm"},{"b":"400000","o":"9A20DC"},{"b":"400000","o":"9A279A","s":"_ZN5mongo9PipelineD15prepareExecutorEPNS_16OperationContextEPNS_10CollectionERKN5boost13intrusive_ptrINS_8PipelineEEERKNS6_INS_17ExpressionContextEEERKNS6_INS_18DocumentSourceSortEEERKNS_11DepsTrackerERKNS_7BSONObjEPSM_SP_"},{"b":"400000","o":"9A3572","s":"_ZN5mongo9PipelineD19prepareCursorSourceEPNS_16OperationContextEPNS_10CollectionERKN5boost13intrusive_ptrINS_8PipelineEEERKNS6_INS_17ExpressionContextEEE"},{"b":"400000","o":"7313E0","s":"_ZN5mongo15PipelineCommand3runEPNS_16OperationContextERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderE"},{"b":"400000","o":"784903","s":"_ZN5mongo7Command3runEPNS_16OperationContextERKNS_3rpc16RequestInterfaceEPNS3_21ReplyBuilderInterfaceE"},{"b":"400000","o":"785794","s":"_ZN5mongo7Command11execCommandEPNS_16OperationContextEPS0_RKNS_3rpc16RequestInterfaceEPNS4_21ReplyBuilderInterfaceE"},{"b":"400000","o":"6DC1F0","s":"_ZN5mongo11runCommandsEPNS_16OperationContextERKNS_3rpc16RequestInterfaceEPNS2_21ReplyBuilderInterfaceE"},{"b":"400000","o":"89DCB5","s":"_ZN5mongo16assembleResponseEPNS_16OperationContextERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE"},{"b":"400000","o":"56441C","s":"_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortE"},{"b":"400000","o":"EC1465","s":"_ZN5mongo17PortMessageServer17handleIncomingMsgEPv"},{"b":"7F10FDE1B000","o":"770A"},{"b":"7F10FDA52000","o":"10682D","s":"clone"}],"processInfo":{ "mongodbVersion" : "3.2.9", "gitVersion" : "22ec9e93b40c85fc7cae7d56e7d6a02fd811088c", "compiledModules" : [], "uname" : { "sysname" : "Linux", "release" : "4.4.0-21-generic", "version" : "#37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016", "machine" : "x86_64" }, "somap" : [ { "elfType" : 2, "b" : "400000" }, { "b" : "7FFCA0558000", "elfType" : 3 }, { "b" : "7F10FE75B000", "path" : "/lib/x86_64-linux-gnu/librt.so.1", "elfType" : 3 }, { "b" : "7F10FE557000", "path" : "/lib/x86_64-linux-gnu/libdl.so.2", "elfType" : 3 }, { "b" : "7F10FE24E000", "path" : "/lib/x86_64-linux-gnu/libm.so.6", "elfType" : 3 }, { "b" : "7F10FE038000", "path" : "/lib/x86_64-linux-gnu/libgcc_s.so.1", "elfType" : 3 }, { "b" : "7F10FDE1B000", "path" : "/lib/x86_64-linux-gnu/libpthread.so.0", "elfType" : 3 }, { "b" : "7F10FDA52000", "path" : "/lib/x86_64-linux-gnu/libc.so.6", "elfType" : 3 }, { "b" : "7F10FE963000", "path" : "/lib64/ld-linux-x86-64.so.2", "elfType" : 3 } ] }}
[MongoDFixture:job0]  mongod(_ZN5mongo15printStackTraceERSo+0x32) [0x1307192]
[MongoDFixture:job0]  mongod(+0xF060B9) [0x13060b9]
[MongoDFixture:job0]  mongod(+0xF06438) [0x1306438]
[MongoDFixture:job0]  libpthread.so.0(+0x113E0) [0x7f10fde2c3e0]
[MongoDFixture:job0]  mongod(_ZNK5mongo26PlanCacheIndexabilityState17getDiscriminatorsENS_10StringDataE+0x14) [0xdf8124]
[MongoDFixture:job0]  mongod(_ZNK5mongo9PlanCache17encodeKeyForMatchEPKNS_15MatchExpressionEPNS_17StringBuilderImplINS_16TrivialAllocatorEEE+0x98) [0xdf3048]
[MongoDFixture:job0]  mongod(_ZNK5mongo9PlanCache10computeKeyERKNS_14CanonicalQueryE+0x53) [0xdf58a3]
[MongoDFixture:job0]  mongod(_ZN5mongo20fillOutPlannerParamsEPNS_16OperationContextEPNS_10CollectionEPNS_14CanonicalQueryEPNS_18QueryPlannerParamsE+0x204) [0xdc9ba4]
[MongoDFixture:job0]  mongod(+0x9C9F08) [0xdc9f08]
[MongoDFixture:job0]  mongod(_ZN5mongo11getExecutorEPNS_16OperationContextEPNS_10CollectionESt10unique_ptrINS_14CanonicalQueryESt14default_deleteIS5_EENS_12PlanExecutor11YieldPolicyEm+0x74) [0xdcb7b4]
[MongoDFixture:job0]  mongod(+0x9A20DC) [0xda20dc]
[MongoDFixture:job0]  mongod(_ZN5mongo9PipelineD15prepareExecutorEPNS_16OperationContextEPNS_10CollectionERKN5boost13intrusive_ptrINS_8PipelineEEERKNS6_INS_17ExpressionContextEEERKNS6_INS_18DocumentSourceSortEEERKNS_11DepsTrackerERKNS_7BSONObjEPSM_SP_+0x31A) [0xda279a]
[MongoDFixture:job0]  mongod(_ZN5mongo9PipelineD19prepareCursorSourceEPNS_16OperationContextEPNS_10CollectionERKN5boost13intrusive_ptrINS_8PipelineEEERKNS6_INS_17ExpressionContextEEE+0x472) [0xda3572]
[MongoDFixture:job0]  mongod(_ZN5mongo15PipelineCommand3runEPNS_16OperationContextERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderE+0x270) [0xb313e0]
[MongoDFixture:job0]  mongod(_ZN5mongo7Command3runEPNS_16OperationContextERKNS_3rpc16RequestInterfaceEPNS3_21ReplyBuilderInterfaceE+0x473) [0xb84903]
[MongoDFixture:job0]  mongod(_ZN5mongo7Command11execCommandEPNS_16OperationContextEPS0_RKNS_3rpc16RequestInterfaceEPNS4_21ReplyBuilderInterfaceE+0x404) [0xb85794]
[MongoDFixture:job0]  mongod(_ZN5mongo11runCommandsEPNS_16OperationContextERKNS_3rpc16RequestInterfaceEPNS2_21ReplyBuilderInterfaceE+0x1F0) [0xadc1f0]
[MongoDFixture:job0]  mongod(_ZN5mongo16assembleResponseEPNS_16OperationContextERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0xB45) [0xc9dcb5]
[MongoDFixture:job0]  mongod(_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortE+0xEC) [0x96441c]
[MongoDFixture:job0]  mongod(_ZN5mongo17PortMessageServer17handleIncomingMsgEPv+0x325) [0x12c1465]
[MongoDFixture:job0]  libpthread.so.0(+0x770A) [0x7f10fde2270a]
[MongoDFixture:job0]  libc.so.6(clone+0x6D) [0x7f10fdb5882d]
[MongoDFixture:job0] -----  END BACKTRACE  -----



 Comments   
Comment by Githook User [ 08/Sep/16 ]

Author:

{u'username': u'visemet', u'name': u'Max Hirschhorn', u'email': u'max.hirschhorn@mongodb.com'}

Message: SERVER-25039 Abort aggregation planning when a catalog operation occurs.

This prevents the aggregation system from trying to continue query
planning when the collection longer exists.

(cherry picked from commit 82cd8943dab085447ee180d4d59c2c5da778c523)
Branch: v3.2
https://github.com/mongodb/mongo/commit/284c0eca4941a450a473267b54aef03ba419f993

Comment by Githook User [ 25/Jul/16 ]

Author:

{u'username': u'visemet', u'name': u'Max Hirschhorn', u'email': u'max.hirschhorn@mongodb.com'}

Message: SERVER-25039 Abort aggregation planning when a catalog operation occurs.

This prevents the aggregation system from trying to continue query
planning when the collection longer exists.
Branch: master
https://github.com/mongodb/mongo/commit/82cd8943dab085447ee180d4d59c2c5da778c523

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