matth-x / MicroOcppSimulator

GNU General Public License v3.0
98 stars 44 forks source link

Meet a memory leak issue by check tool valgrind #7

Closed zhushengsheng001 closed 1 year ago

zhushengsheng001 commented 1 year ago

Hi matth-x, A memory leak is reported by valgrind, it is related with openssl library. This may be my running enviroment issue, such as openssl version or other issues, or a real mongoose lib issue. I will look into this later. The caught log and openssl version info are as below: ==5960== by 0x1306E1: connect_conn (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== ==5960== 176 bytes in 1 blocks are still reachable in loss record 189 of 191 ==5960== at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==5960== by 0x5109057: CRYPTO_malloc (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==5960== by 0x51C1CBF: lh_new (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==5960== by 0x51C4222: ??? (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==5960== by 0x51C442F: ??? (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==5960== by 0x51C526D: ERR_get_state (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==5960== by 0x51C53EE: ERR_clear_error (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==5960== by 0x4E68B74: ??? (in /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0) ==5960== by 0x1332BC: mg_tls_handshake (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== by 0x1331DA: mg_tls_init (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== by 0x1F9A8F: ws_cb(mg_connection, int, void, void) (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== by 0x120961: mg_call (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== ==5960== 512 bytes in 1 blocks are still reachable in loss record 190 of 191 ==5960== at 0x4C33D2F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==5960== by 0x510914C: CRYPTO_realloc (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==5960== by 0x51C1FBA: lh_insert (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==5960== by 0x510BECA: OBJ_NAME_add (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==5960== by 0x51CC559: EVP_add_digest (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==5960== by 0x4E8A2DB: SSL_library_init (in /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0) ==5960== by 0x132DA3: mg_tls_init (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== by 0x1F9A8F: ws_cb(mg_connection, int, void, void) (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== by 0x120961: mg_call (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== by 0x1306E1: connect_conn (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== by 0x1319EF: mg_mgr_poll (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== by 0x115CAD: main (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== ==5960== 600 bytes in 1 blocks are still reachable in loss record 191 of 191 ==5960== at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==5960== by 0x5109057: CRYPTO_malloc (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==5960== by 0x51C521D: ERR_get_state (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==5960== by 0x51C53EE: ERR_clear_error (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==5960== by 0x4E68B74: ??? (in /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0) ==5960== by 0x1332BC: mg_tls_handshake (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== by 0x1331DA: mg_tls_init (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== by 0x1F9A8F: ws_cb(mg_connection, int, void, void*) (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== by 0x120961: mg_call (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== by 0x1306E1: connect_conn (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== by 0x1319EF: mg_mgr_poll (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== by 0x115CAD: main (in /home/alientek/workshop/MicroOcppSimulator/build/mo_simulator) ==5960== ==5960== LEAK SUMMARY: ==5960== definitely lost: 0 bytes in 0 blocks ==5960== indirectly lost: 0 bytes in 0 blocks ==5960== possibly lost: 0 bytes in 0 blocks ==5960== still reachable: 6,488 bytes in 191 blocks ==5960== suppressed: 0 bytes in 0 blocks ==5960== ==5960== For counts of detected and suppressed errors, rerun with: -v ==5960== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) root@ubuntu:/home/alientek/workshop/MicroOcppSimulator# openssl version OpenSSL 1.1.1 11 Sep 2018

zhushengsheng001 commented 1 year ago

Checked with openssl 1.1.1f, this leak disappeared. Close this issue.