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

memory leak. query time out when sharding.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.0.5, 2.0.6, 2.2.3
    • Component/s: Sharding
    • Environment:
      linux , 3 shard, each 3 server replicaset.
    • Sharding
    • ALL

      ConnectionShardStatus preserve map<DBClientBase*, map<string,unsigned long long> > _map; to keep sequence number. when checkShardVersion , call setSequence to set de map, use key :
      conn = getVersionable(&conn_in); (which is connection to master of replicaset when use shard and replicaset). but when shardconnection onDestroy, resetShardVersion use key is ptr to shardconnection , not the connection to master of replicaset. So each time _map.erase(conn) return 0, and _map size always increase.

      because i use short connection in web client , each time client close connection , mongos destroy shardconnection and cause _map increate. sometimes mongos create new connection to mongod, with same pointer position with an old connection object, cause the new connection can get an positive sequence from _map , of 0!. it will cause checkShardVersion run >2 times, and cause web client wait 3 -5 seconds.

      i modify shard_version.cpp resetShardVersion function , when conn type is SET, connectionShardStatus.reset( getVersionable(conn) ); , fix this problem.

            backlog-server-sharding [DO NOT USE] Backlog - Sharding Team
            peanutgyz peanutgyz
            1 Vote for this issue
            8 Start watching this issue