[SERVER-11297] Running a query with CursorTailable flag against non-existent collection crashes mongod. Created: 21/Oct/13  Updated: 11/Jul/16  Resolved: 22/Oct/13

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

Type: Bug Priority: Major - P3
Reporter: Andy Schwerin Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:
  1. Start mongod on fresh data directory

    $ ./mongod

  2. Run the following from the shell, assuming test.foo is a non-existent collection:

    db.foo.find({}).addOption(2)

Expected behavior:
Shell should get back a cursor with no documents, or some kind of error message.

Actual behavior:
Stack trace and seg fault from mongod. See description.

Participants:

 Description   

Running under mongod, we see that somehow "this" is NULL at collection.cpp:180.

$ addr2line -i -e mongod 0xe21c33 0x79479f 0x794bc5 0x7f23b05e4cb0 0xca1ed0 0xbaad76 0xb026bc 0xa548d3 0x79ec12 0xde54bd 0x7f23b05dce9a 0x7f23af4bdccd 
/data/rbuild/mongo/src/mongo/util/stacktrace.cpp:304
/usr/include/c++/4.6/sstream:458
/data/rbuild/mongo/src/mongo/db/db.cpp:1011
/usr/include/c++/4.6/sstream:439
/data/rbuild/mongo/src/mongo/db/db.cpp:1028
??:0
/data/rbuild/mongo/src/mongo/db/structure/collection.cpp:180
/data/rbuild/mongo/src/mongo/db/query/new_find.cpp:717
/data/rbuild/mongo/src/mongo/db/ops/query.cpp:1105
/data/rbuild/mongo/src/mongo/db/instance.cpp:280
/data/rbuild/mongo/src/mongo/db/instance.cpp:443
/data/rbuild/mongo/src/mongo/util/net/hostandport.h:31
/data/rbuild/mongo/src/mongo/db/db.cpp:199
/data/rbuild/mongo/src/mongo/util/net/message_server_port.cpp:251
??:0
??:0



 Comments   
Comment by auto [ 22/Oct/13 ]

Author:

{u'username': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: SERVER-11297: fix tailable cursor with non-existant collection
Branch: master
https://github.com/mongodb/mongo/commit/82c69b1bf96473f7d5795ad9ab3fa7b60a7a02a4

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