I used pymongo to create indexes of a collection, but sometimes the command hangs forever. Here is the simplified code:
collection.drop()
collection.create_indexes(mongo_indexes)
Here is the backtrace of the connection thread:
[Switching to thread 121 (Thread 0x7f06e8cd0700 (LWP 141638))]
#0 0x00007f06ff4cc54d in __lll_lock_wait () from /lib64/libpthread.so.0
(gdb) bt
#0 0x00007f06ff4cc54d in __lll_lock_wait () from /lib64/libpthread.so.0
#1 0x00007f06ff4c7e9b in _L_lock_883 () from /lib64/libpthread.so.0
#2 0x00007f06ff4c7d68 in pthread_mutex_lock () from /lib64/libpthread.so.0
#3 0x0000000001a62c2b in __wt_evict_file_exclusive_on ()
#4 0x0000000001a0199d in __wt_btree_open ()
#5 0x0000000001a3bcd3 in __wt_conn_btree_open ()
#6 0x0000000001ac1dbd in __wt_session_get_btree ()
#7 0x0000000001aa82ad in __wt_schema_create ()
#8 0x0000000001aa8d4a in ?? ()
#9 0x0000000001aa8737 in __wt_schema_create ()
#10 0x0000000001abf286 in __wt_session_create ()
#11 0x0000000001abf63e in ?? ()
#12 0x00000000010a6153 in mongo::WiredTigerIndex::Create(mongo::OperationContext*, std::string const&, std::string const&) ()
#13 0x00000000010aea62 in mongo::WiredTigerKVEngine::createSortedDataInterface(mongo::OperationContext*, mongo::StringData, mongo::IndexDescriptor const*) ()
#14 0x000000000100e94c in mongo::KVCollectionCatalogEntry::prepareForIndexBuild(mongo::OperationContext*, mongo::IndexDescriptor const*) ()
#15 0x0000000000b22e66 in mongo::IndexCatalog::IndexBuildBlock::init() ()
#16 0x0000000000b271ba in mongo::MultiIndexBlock::init(std::vector<mongo::BSONObj, std::allocator<mongo::BSONObj> > const&) ()
#17 0x0000000000b52ffe in mongo::CmdCreateIndex::run(mongo::OperationContext*, std::string const&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder&) ()
#18 0x0000000000be3453 in mongo::Command::run(mongo::OperationContext*, mongo::rpc::RequestInterface const&, mongo::rpc::ReplyBuilderInterface*) ()
#19 0x0000000000be430c in mongo::Command::execCommand(mongo::OperationContext*, mongo::Command*, mongo::rpc::RequestInterface const&, mongo::rpc::ReplyBuilderInterface*) ()
#20 0x0000000000b3c566 in mongo::runCommands(mongo::OperationContext*, mongo::rpc::RequestInterface const&, mongo::rpc::ReplyBuilderInterface*) ()
#21 0x0000000000cf1965 in ?? ()
#22 0x0000000000cf4206 in mongo::assembleResponse(mongo::OperationContext*, mongo::Message&, mongo::DbResponse&, mongo::HostAndPort const&) ()
#23 0x00000000009c01fc in ?? ()
#24 0x00000000012f9725 in mongo::PortMessageServer::handleIncomingMsg(void*) ()
#25 0x00007f06ff4c5ea5 in start_thread () from /lib64/libpthread.so.0
#26 0x00007f06ff1ee8dd in clone () from /lib64/libc.so.6