Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-13750

ConvertToCapped on empty collection aborts after invariant() failure

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.6.2, 2.7.0
    • Affects Version/s: 2.6.1
    • Component/s: Storage
    • None
    • Fully Compatible
    • ALL

      Issue Status as of Jun 09, 2014

      ISSUE SUMMARY
      A bug in the convertToCapped command causes the server to abort with an assertion failure if the collection does not exist.

      USER IMPACT
      Server defensively quits when hitting the assertion, which can affect replica set quorum and in the worst case availability of the replica set.

      WORKAROUNDS
      Check first if a collection exists before running the convertToCapped command.

      AFFECTED VERSIONS
      Versions 2.6.0 and 2.6.1 are affected by this issue.

      FIX VERSION
      The fix is included in the 2.6.2 production release.

      RESOLUTION DETAILS
      We now check if the collection exists before executing the command.

      Original description

      Run convertToCapped on empty collection:

      db.runCommand({convertToCapped: 'a.a', size: 4096});

      and mongod will abort

      ***aborting after invariant() failure
      
      
      2014-04-25T21:22:02.844+0000 [conn11] SEVERE: Got signal: 6 (Aborted).
      Backtrace:0xf81006 0xf80de0 0x7fc6fa242920 0x7fc6fa2428a5 0x7fc6fa244085 0xf1802b 0xab9e2f 0x9077ab 0x905e7d 0x9b4174 0x9b5c25 0x9b645e 0xc4da55 0xac964e 0xace300 0x7bae2f 0xf3f189 0x7fc6fb59c851 0x7fc6fa2f76dd 
       mongod(mongo::printStackTrace(std::basic_ostream<char, std::char_traits<char> >&)+0x26) [0xf81006]
       mongod() [0xf80de0]
       /lib64/libc.so.6(+0x32920) [0x7fc6fa242920]
       /lib64/libc.so.6(gsignal+0x35) [0x7fc6fa2428a5]
       /lib64/libc.so.6(abort+0x175) [0x7fc6fa244085]
       mongod(mongo::invariantFailed(char const*, char const*, unsigned int)+0x1eb) [0xf1802b]
       mongod() [0xab9e2f]
       mongod(mongo::CmdConvertToCapped::stopIndexBuilds(mongo::Database*, mongo::BSONObj const&)+0x10b) [0x9077ab]
       mongod(mongo::CmdConvertToCapped::run(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mongo::BSONObj&, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, mongo::BSONObjBuilder&, bool)+0x7d) [0x905e7d]
       mongod(mongo::_execCommand(mongo::Command*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mongo::BSONObj&, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, mongo::BSONObjBuilder&, bool)+0x34) [0x9b4174]
       mongod(mongo::Command::execCommand(mongo::Command*, mongo::Client&, int, char const*, mongo::BSONObj&, mongo::BSONObjBuilder&, bool)+0xfa5) [0x9b5c25]
       mongod(mongo::_runCommands(char const*, mongo::BSONObj&, mongo::_BufBuilder<mongo::TrivialAllocator>&, mongo::BSONObjBuilder&, bool, int)+0x2be) [0x9b645e]
       mongod(mongo::newRunQuery(mongo::Message&, mongo::QueryMessage&, mongo::CurOp&, mongo::Message&)+0xa55) [0xc4da55]
       mongod() [0xac964e]
       mongod(mongo::assembleResponse(mongo::Message&, mongo::DbResponse&, mongo::HostAndPort const&)+0x4b0) [0xace300]
       mongod(mongo::MyMessageHandler::process(mongo::Message&, mongo::AbstractMessagingPort*, mongo::LastError*)+0xef) [0x7bae2f]
       mongod(mongo::PortMessageServer::handleIncomingMsg(void*)+0x5a9) [0xf3f189]
       /lib64/libpthread.so.0(+0x7851) [0x7fc6fb59c851]
       /lib64/libc.so.6(clone+0x6d) [0x7fc6fa2f76dd]
      

      (via mongod-user list)

            Assignee:
            matt.dannenberg Matt Dannenberg
            Reporter:
            michael.grundy Michael Grundy
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: