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

While inserting records into MongoDB, the used memory of the instance running MongoDB keeps growing until it is shutdown

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.2.10, 3.2.11
    • Component/s: WiredTiger
    • None
    • ALL
      • Run the mongoDB with its default configuration on an instance of 1GB RAM.
      • Insert records for a long period of time and monitor the memory of the instance.

      I am running mongoDB server on an instance of 1 GB RAM. I have my client application on the other side inserting records for a somewhat long period of time (~ 1 day to 2 days).

      What is happening is that the free memory of the instance keeps decreasing (or the used memory keeps increasing) until it reaches the maximum and seems the operating system kills the mongoDB.

      I had two types of exceptions:

      *The first one: *

      org.springframework.dao.DataIntegrityViolationException: { "serverUsed" : "52.212.43.249:27017" , "ok" : 1 , "n" : 0 , "err" : "WiredTigerRecordStore::insertRecord 12: Cannot allocate memory" , "code" : 8}; nested exception is com.mongodb.WriteConcernException: { "serverUsed" : "52.212.43.249:27017" , "ok" : 1 , "n" : 0 , "err" : "WiredTigerRecordStore::insertRecord 12: Cannot allocate memory" , "code" : 8}
      	at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:85)
      	at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2114)
      	at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:464)
      	at org.springframework.data.mongodb.core.MongoTemplate.insertDBObject(MongoTemplate.java:1027)
      	at org.springframework.data.mongodb.core.MongoTemplate.doInsert(MongoTemplate.java:838)
      	at org.springframework.data.mongodb.core.MongoTemplate.insert(MongoTemplate.java:777)
      	at org.springframework.data.mongodb.repository.support.SimpleMongoRepository.save(SimpleMongoRepository.java:78)
      	at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:503)
      	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:488)
      	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460)
      

      or the second one (resulting from shutting down the mongoDB after the memory is exhausted)

      org.springframework.dao.DataAccessResourceFailureException: Timed out after 10000 ms while waiting for a server that matches AnyServerSelector{}. Client view of cluster state is {type=Unknown, servers=[{address=52.212.43.249:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException: Connection refused: connect}}]; nested exception is com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting for a server that matches AnyServerSelector{}. Client view of cluster state is {type=Unknown, servers=[{address=52.212.43.249:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException: Connection refused: connect}}]
      	at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:77)
      	at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2114)
      	at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:464)
      	at org.springframework.data.mongodb.core.MongoTemplate.insertDBObject(MongoTemplate.java:1027)
      	at org.springframework.data.mongodb.core.MongoTemplate.doInsert(MongoTemplate.java:838)
      	at org.springframework.data.mongodb.core.MongoTemplate.insert(MongoTemplate.java:777)
      	at org.springframework.data.mongodb.repository.support.SimpleMongoRepository.save(SimpleMongoRepository.java:78)
      

            Assignee:
            kelsey.schubert@mongodb.com Kelsey Schubert
            Reporter:
            haytham.salhi Haytham Salhi
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: