[CDRIVER-1884] Memory leak in testing framework Created: 25/Oct/16  Updated: 03/May/17  Resolved: 10/Dec/16

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: TBD

Type: Bug Priority: Minor - P4
Reporter: Hannes Magnusson Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

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
}



 Comments   
Comment by Githook User [ 11/Dec/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-1884 leaks in mock server tests
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/0dd90eee6599a9d06c2e06ded44d0571a1e42d26

Comment by Githook User [ 25/Oct/16 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-1884 ignore test suite leaks
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/963802090e858e1d6b13e27710082d62affcaf01

Generated at Wed Feb 07 21:13:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.