Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-1884

Memory leak in testing framework

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • TBD
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      make valgrind TEST_ARGS="--no-fork -l /BulkOperation/opts/collation/multi/w0/wire5"                                                    
      MONGOC_TEST_VALGRIND=on /bin/bash ./libtool --mode=execute valgrind --error-exitcode=1 --leak-check=full --suppressions=./valgrind.suppressions ./test-libmongoc --no-fork --no-fork -l /BulkOperation/opts/collation/multi/w0/wire5
      ==31143== Memcheck, a memory error detector
      ==31143== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
      ==31143== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
      ==31143== Command: /home/bjori/Sources/mongoc/.libs/lt-test-libmongoc --no-fork --no-fork -l /BulkOperation/opts/collation/multi/w0/wire5
      ==31143== 
      {
        "host": {
          "sysname": "Linux",
          "release": "4.4.0-42-generic",
          "machine": "x86_64",
          "memory": {
            "pagesize": 4096,
            "npages": 16485484
          }
        },
        "auth": { "user": "", "pass": "" }, 
        "addr": { "host": "localhost", "port": 27017, "uri": "" },
        "gssapi": { "host": "", "user": "" }, 
        "uds": "%2Ftmp%2Fmongodb-27017.sock", 
        "SSL": {
          "enabled": false,
          "weak_cert_validation": false,
          "pem_file": "",
          "pem_pwd": "",
          "ca_file": "",
          "ca_dir": "",
          "crl_file": ""
        },
        "framework": {
          "monitoringVerbose": false,
          "mockServerLog": "",
          "futureTimeoutMS": 10000,
          "majorityReadConcern": false,
          "skipLiveTests": false,
          "IPv6": false
        },
        "options": {
          "fork": false,
          "tracing": false
        },
        "results": [
          { "status": "PASS", "test_file": "/BulkOperation/opts/collation/multi/w0/wire5", "seed": "1101136988", "start": 691413.012371874, "end": 691413.817008597, "elapsed": 0.804636723  }
          { "status": "PASS", "test_file": "/BulkOperation/opts/collation/multi/w0/wire5", "seed": "1526420655", "start": 691413.834081100, "end": 691413.953840307, "elapsed": 0.119759207  }
        ]
      }
      ==31143== 
      ==31143== HEAP SUMMARY:
      ==31143==     in use at exit: 96,568 bytes in 3,222 blocks
      ==31143==   total heap usage: 8,246 allocs, 5,024 frees, 7,224,855 bytes allocated
      ==31143== 
      ==31143== 256 bytes in 2 blocks are definitely lost in loss record 564 of 610
      ==31143==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==31143==    by 0x4E5B2BB: bson_malloc0 (bson-memory.c:105)
      ==31143==    by 0x4101CD: mock_server_reply_multi (mock-server.c:1724)
      ==31143==    by 0x40F2DE: mock_server_replies (mock-server.c:1224)
      ==31143==    by 0x40E7DA: auto_ismaster (mock-server.c:472)
      ==31143==    by 0x40FF7F: worker_thread (mock-server.c:1656)
      ==31143==    by 0x5B536F9: start_thread (pthread_create.c:333)
      ==31143== 
      ==31143== LEAK SUMMARY:
      ==31143==    definitely lost: 256 bytes in 2 blocks
      ==31143==    indirectly lost: 0 bytes in 0 blocks
      ==31143==      possibly lost: 0 bytes in 0 blocks
      ==31143==    still reachable: 0 bytes in 0 blocks
      ==31143==         suppressed: 96,312 bytes in 3,220 blocks
      ==31143== 
      

      As a workaround we've added it to the suppression list:

      {
         test_framework_reply_leaks
         Memcheck:Leak
         match-leak-kinds: definite
         fun:calloc
         fun:bson_malloc0
         fun:mock_server_reply_multi
      }
      

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            bjori Hannes Magnusson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: