Subject: | Memory leak from Net::SSLeay::connect |
I have a long-running process which talks lots of SSL, by constantly starting and shutting down new connections talking to many hosts.
Previously I had found and fixed some memory leaks visible at the SV heap level, and now the process no longer leaks according to SV count, but yet the virtual memory size still increases very linearly over time.
Having run this for a while in valgrind, I get the following leak report:
==9498== 109,623 (7,392 direct, 102,231 indirect) bytes in 22 blocks are definitely lost in loss record 143 of 143
==9498== at 0x4C2BBAF: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9498== by 0xE34442D: CRYPTO_zalloc (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==9498== by 0xE27BA27: ??? (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==9498== by 0xE27987E: ??? (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==9498== by 0xE279F5C: ASN1_item_ex_d2i (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==9498== by 0xE279FDA: ASN1_item_d2i (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==9498== by 0xE3B156C: d2i_X509_AUX (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==9498== by 0xE35763D: PEM_ASN1_read_bio (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==9498== by 0xE3A152C: X509_load_cert_file (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==9498== by 0xE3A0C6F: ??? (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==9498== by 0xE3A516A: X509_STORE_CTX_get_by_subject (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==9498== by 0xE3A588C: X509_STORE_CTX_get1_issuer (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==9498== by 0xE3AA67E: ??? (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==9498== by 0xE3AB47F: X509_verify_cert (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==9498== by 0xDF915D7: ??? (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==9498== by 0xDFA3DCA: ??? (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==9498== by 0xDFA14FE: ??? (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==9498== by 0xDF99F60: SSL_do_handshake (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==9498== by 0xDD367B0: XS_Net__SSLeay_connect (SSLeay.c:2454)
==9498== by 0x242F1D: Perl_pp_entersub (pp_hot.c:3988)
==9498==
==9498== LEAK SUMMARY:
==9498== definitely lost: 7,829 bytes in 49 blocks
==9498== indirectly lost: 107,020 bytes in 1,745 blocks
I'm still investigating this, so I hope to have more details and analysis later.
--
Paul Evans