[SERVER-18054] Crash when running findAndModify against non-existent collection Created: 14/Apr/15  Updated: 19/Sep/15  Resolved: 15/Apr/15

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

Type: Bug Priority: Major - P3
Reporter: Kamran K. Assignee: Charlie Swanson
Resolution: Done Votes: 0
Labels: 32qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-16063 Rewrite findAndModify Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Quint Iteration 3.1.2
Participants:

 Description   

This crash was introduced by the changes from SERVER-16063, so it only affects very recent versions of master.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff43f8700 (LWP 3864)]
0x00000000011f262d in mongo::NamespaceString::db (this=0x18) at src/mongo/db/namespace_string-inl.h:35
35	        return _dotIndex == std::string::npos ?
(gdb) bt
#0  0x00000000011f262d in mongo::NamespaceString::db (this=0x18) at src/mongo/db/namespace_string-inl.h:35
#1  0x00000000015b1a48 in mongo::(anonymous namespace)::applyProjection (txn=0x7ffff43f77e0, collection=0x0, cq=0x7fffb8007800, proj=..., allowPositional=true, ws=0x7fffb80294a0, root=...) at src/mongo/db/query/get_executor.cpp:673
#2  0x00000000015b3787 in mongo::getExecutorUpdate (txn=0x7ffff43f77e0, collection=0x0, parsedUpdate=0x7ffff43f6650, opDebug=0x7fffb8000ff8, execOut=0x7ffff43f6500) at src/mongo/db/query/get_executor.cpp:955
#3  0x000000000131d5c7 in mongo::CmdFindAndModify::run (this=0x292e420 <mongo::cmdFindAndModify>, txn=0x7ffff43f77e0, dbName=..., cmdObj=..., options=0, errmsg=..., result=..., fromRepl=false)
    at src/mongo/db/commands/find_and_modify.cpp:523
#4  0x00000000013a33e1 in mongo::_execCommand (txn=0x7ffff43f77e0, c=0x292e420 <mongo::cmdFindAndModify>, dbname=..., cmdObj=..., queryOptions=0, errmsg=..., result=..., fromRepl=false) at src/mongo/db/dbcommands.cpp:1139
#5  0x00000000013a4398 in mongo::Command::execCommand (txn=0x7ffff43f77e0, c=0x292e420 <mongo::cmdFindAndModify>, queryOptions=0, cmdns=0x7fffb8003074 "test.$cmd", cmdObj=..., result=..., fromRepl=false)
    at src/mongo/db/dbcommands.cpp:1357
#6  0x00000000013a4cf5 in mongo::_runCommands (txn=0x7ffff43f77e0, ns=0x7fffb8003074 "test.$cmd", _cmdobj=..., b=..., anObjBuilder=..., fromRepl=false, queryOptions=0) at src/mongo/db/dbcommands.cpp:1431
#7  0x00000000013a50cc in mongo::runCommands (txn=0x7ffff43f77e0, ns=0x7fffb8003074 "test.$cmd", jsobj=..., curop=..., b=..., anObjBuilder=..., fromRepl=false, queryOptions=0) at src/mongo/db/dbcommands.cpp:1461
#8  0x00000000014aeebd in mongo::receivedCommand (txn=0x7ffff43f77e0, nss=..., client=..., dbResponse=..., message=...) at src/mongo/db/instance.cpp:245
#9  0x00000000014b0294 in mongo::assembleResponse (txn=0x7ffff43f77e0, m=..., dbresponse=..., remote=...) at src/mongo/db/instance.cpp:482
#10 0x000000000118fd7e in mongo::MyMessageHandler::process (this=0x29b4810, m=..., port=0x2a044c0, le=0x7fffb80008c0) at src/mongo/db/db.cpp:171
#11 0x000000000197cfb2 in mongo::PortMessageServer::handleIncomingMsg (arg=0x2a044c0) at src/mongo/util/net/message_server_port.cpp:230
#12 0x00007ffff6f98182 in start_thread (arg=0x7ffff43f8700) at pthread_create.c:312
#13 0x00007ffff6cc547d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
 
(gdb) f 1
#1  0x00000000015b1a48 in mongo::(anonymous namespace)::applyProjection (txn=0x7ffff43f77e0, collection=0x0, cq=0x7fffb8007800, proj=..., allowPositional=true, ws=0x7fffb80294a0, root=...) at src/mongo/db/query/get_executor.cpp:673
673	        ProjectionStageParams params(WhereCallbackReal(txn, collection->ns().db()));
(gdb) p collection
$1 = (mongo::Collection *) 0x0


Version: 02db7fa76



 Comments   
Comment by Githook User [ 15/Apr/15 ]

Author:

{u'username': u'cswanson310', u'name': u'Charlie', u'email': u'charlie.swanson@mongodb.com'}

Message: SERVER-18054 Fix crash when running findAndModify against non-existent collection.
Branch: master
https://github.com/mongodb/mongo/commit/6407a1f3d508509a66930f769d7663ef48b0b4ea

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