View Issue Details

IDProjectCategoryView StatusLast Update
0005011Talermerchant backend API (C)public2017-06-06 14:18
ReporterChristian GrothoffAssigned ToChristian Grothoff 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Platformi7OSDebian GNU/LinuxOS Versionsqueeze
Product VersionSVN HEAD 
Target Version0.3Fixed in Version0.3 
Summary0005011: taler-merchant-httpd leaks memory
Description==13622== HEAP SUMMARY:
==13622== in use at exit: 850,020 bytes in 3,156 blocks
==13622== total heap usage: 30,603,831 allocs, 30,600,675 frees, 968,583,710 bytes allocated
==13622==
==13622== 23 bytes in 1 blocks are definitely lost in loss record 27 of 87
==13622== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==13622== by 0x60BB89C: GNUNET_xmalloc_unchecked_ (common_allocation.c:227)
==13622== by 0x60BB23A: GNUNET_xmalloc_ (common_allocation.c:75)
==13622== by 0x60BBCA0: GNUNET_xstrdup_ (common_allocation.c:354)
==13622== by 0x5040963: parse_json_auditor (exchange_api_handle.c:400)
==13622== by 0x5041942: decode_keys_json (exchange_api_handle.c:592)
==13622== by 0x5041EBC: keys_completed_cb (exchange_api_handle.c:711)
==13622== by 0x5C9B936: GNUNET_CURL_perform (curl.c:472)
==13622== by 0x5C9BEAC: context_task (curl_reschedule.c:94)
==13622== by 0x60F930D: run_ready (scheduler.c:670)
==13622== by 0x60F9C58: GNUNET_SCHEDULER_run (scheduler.c:937)
==13622== by 0x60F471D: GNUNET_PROGRAM_run2 (program.c:300)
==13622==
==13622== 173 (32 direct, 141 indirect) bytes in 1 blocks are definitely lost in loss record 55 of 87
==13622== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==13622== by 0x60BB89C: GNUNET_xmalloc_unchecked_ (common_allocation.c:227)
==13622== by 0x60BB23A: GNUNET_xmalloc_ (common_allocation.c:75)
==13622== by 0x1116D1: process_wire_fees (taler-merchant-httpd_exchanges.c:320)
==13622== by 0x5053DA2: TALER_EXCHANGE_wire_get_fees (exchange_api_wire.c:453)
==13622== by 0x111F70: handle_wire_data (taler-merchant-httpd_exchanges.c:507)
==13622== by 0x5053396: handle_wire_finished (exchange_api_wire.c:229)
==13622== by 0x5C9B936: GNUNET_CURL_perform (curl.c:472)
==13622== by 0x5C9BEAC: context_task (curl_reschedule.c:94)
==13622== by 0x60F930D: run_ready (scheduler.c:670)
==13622== by 0x60F9C58: GNUNET_SCHEDULER_run (scheduler.c:937)
==13622== by 0x60F471D: GNUNET_PROGRAM_run2 (program.c:300)
==13622==
==13622== 200 bytes in 1 blocks are definitely lost in loss record 56 of 87
==13622== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==13622== by 0x60BB89C: GNUNET_xmalloc_unchecked_ (common_allocation.c:227)
==13622== by 0x60BB23A: GNUNET_xmalloc_ (common_allocation.c:75)
==13622== by 0x5040A17: parse_json_auditor (exchange_api_handle.c:408)
==13622== by 0x5041942: decode_keys_json (exchange_api_handle.c:592)
==13622== by 0x5041EBC: keys_completed_cb (exchange_api_handle.c:711)
==13622== by 0x5C9B936: GNUNET_CURL_perform (curl.c:472)
==13622== by 0x5C9BEAC: context_task (curl_reschedule.c:94)
==13622== by 0x60F930D: run_ready (scheduler.c:670)
==13622== by 0x60F9C58: GNUNET_SCHEDULER_run (scheduler.c:937)
==13622== by 0x60F471D: GNUNET_PROGRAM_run2 (program.c:300)
==13622== by 0x60F4874: GNUNET_PROGRAM_run (program.c:339)
==13622==
==13622== 1,024 bytes in 1 blocks are possibly lost in loss record 67 of 87
==13622== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==13622== by 0x6E794A7: ??? (in /usr/lib/x86_64-linux-gnu/libpq.so.5.9)
==13622== by 0x6E7AEAB: ??? (in /usr/lib/x86_64-linux-gnu/libpq.so.5.9)
==13622== by 0x6E8594D: ??? (in /usr/lib/x86_64-linux-gnu/libpq.so.5.9)
==13622== by 0x6E7C1D7: PQgetResult (in /usr/lib/x86_64-linux-gnu/libpq.so.5.9)
==13622== by 0x6E7C52C: ??? (in /usr/lib/x86_64-linux-gnu/libpq.so.5.9)
==13622== by 0xC460B2F: ???
==13622== by 0xC258056: ???
==13622== by 0x1171BD: parse_pay (taler-merchant-httpd_pay.c:1049)
==13622== by 0x11816D: handler_pay_json (taler-merchant-httpd_pay.c:1291)
==13622== by 0x118E74: MH_handler_pay (taler-merchant-httpd_pay.c:1494)
==13622== by 0x10CBBF: url_handler (taler-merchant-httpd.c:234)
==13622==
==13622== 4,096 bytes in 2 blocks are possibly lost in loss record 73 of 87
==13622== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==13622== by 0x6E79CD9: ??? (in /usr/lib/x86_64-linux-gnu/libpq.so.5.9)
==13622== by 0x6E84F4E: ??? (in /usr/lib/x86_64-linux-gnu/libpq.so.5.9)
==13622== by 0x6E7C1D7: PQgetResult (in /usr/lib/x86_64-linux-gnu/libpq.so.5.9)
==13622== by 0x6E7C52C: ??? (in /usr/lib/x86_64-linux-gnu/libpq.so.5.9)
==13622== by 0xC460B2F: ???
==13622== by 0xC258056: ???
==13622== by 0x1171BD: parse_pay (taler-merchant-httpd_pay.c:1049)
==13622== by 0x11816D: handler_pay_json (taler-merchant-httpd_pay.c:1291)
==13622== by 0x118E74: MH_handler_pay (taler-merchant-httpd_pay.c:1494)
==13622== by 0x10CBBF: url_handler (taler-merchant-httpd.c:234)
==13622== by 0x586E82E: call_connection_handler (connection.c:1929)
==13622==
==13622== 5,328 bytes in 222 blocks are definitely lost in loss record 75 of 87
==13622== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==13622== by 0x5A942ED: json_integer (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x1145F4: proposal_put (taler-merchant-httpd_proposal.c:228)
==13622== by 0x114B91: MH_handler_proposal_put (taler-merchant-httpd_proposal.c:379)
==13622== by 0x10CBBF: url_handler (taler-merchant-httpd.c:234)
==13622== by 0x586E82E: call_connection_handler (connection.c:1929)
==13622== by 0x5870746: MHD_connection_handle_idle (connection.c:3134)
==13622== by 0x5873030: call_handlers (daemon.c:1154)
==13622== by 0x587714F: internal_run_from_select (daemon.c:3388)
==13622== by 0x5877837: MHD_select (daemon.c:3648)
==13622== by 0x587928D: MHD_run (daemon.c:4487)
==13622== by 0x10CEA6: run_daemon (taler-merchant-httpd.c:370)
==13622==
==13622== 15,404 (48 direct, 15,356 indirect) bytes in 1 blocks are definitely lost in loss record 79 of 87
==13622== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==13622== by 0x5A93F3A: json_array (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A90EAC: ??? (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A90D69: ??? (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A90F59: ??? (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A90D69: ??? (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A91105: ??? (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A913AD: json_loadb (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5C9B4E5: download_get_result (curl.c:413)
==13622== by 0x5C9B915: GNUNET_CURL_perform (curl.c:469)
==13622== by 0x5C9BEAC: context_task (curl_reschedule.c:94)
==13622== by 0x60F930D: run_ready (scheduler.c:670)
==13622==
==13622== 28,182 (7,808 direct, 20,374 indirect) bytes in 61 blocks are definitely lost in loss record 81 of 87
==13622== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==13622== by 0x5A8F56C: ??? (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A93D16: json_object (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A92B64: ??? (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A92F68: json_vpack_ex (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A9317F: json_pack (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x525C118: TALER_JSON_from_amount (json_helper.c:51)
==13622== by 0x1145B1: proposal_put (taler-merchant-httpd_proposal.c:220)
==13622== by 0x114B91: MH_handler_proposal_put (taler-merchant-httpd_proposal.c:379)
==13622== by 0x10CBBF: url_handler (taler-merchant-httpd.c:234)
==13622== by 0x586E82E: call_connection_handler (connection.c:1929)
==13622== by 0x5870746: MHD_connection_handle_idle (connection.c:3134)
==13622==
==13622== 35,112 (4,281 direct, 30,831 indirect) bytes in 76 blocks are definitely lost in loss record 83 of 87
==13622== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==13622== by 0x5A8F7BA: ??? (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A94756: json_object_set_new_nocheck (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A92C11: ??? (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A92F68: json_vpack_ex (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A9317F: json_pack (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x525C118: TALER_JSON_from_amount (json_helper.c:51)
==13622== by 0x1145B1: proposal_put (taler-merchant-httpd_proposal.c:220)
==13622== by 0x114B91: MH_handler_proposal_put (taler-merchant-httpd_proposal.c:379)
==13622== by 0x10CBBF: url_handler (taler-merchant-httpd.c:234)
==13622== by 0x586E82E: call_connection_handler (connection.c:1929)
==13622== by 0x5870746: MHD_connection_handle_idle (connection.c:3134)
==13622==
==13622== 39,270 (6,800 direct, 32,470 indirect) bytes in 85 blocks are definitely lost in loss record 84 of 87
==13622== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==13622== by 0x5A93CEA: json_object (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A92B64: ??? (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A92F68: json_vpack_ex (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x5A9317F: json_pack (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.9.0)
==13622== by 0x525C118: TALER_JSON_from_amount (json_helper.c:51)
==13622== by 0x1145B1: proposal_put (taler-merchant-httpd_proposal.c:220)
==13622== by 0x114B91: MH_handler_proposal_put (taler-merchant-httpd_proposal.c:379)
==13622== by 0x10CBBF: url_handler (taler-merchant-httpd.c:234)
==13622== by 0x586E82E: call_connection_handler (connection.c:1929)
==13622== by 0x5870746: MHD_connection_handle_idle (connection.c:3134)
==13622== by 0x5873030: call_handlers (daemon.c:1154)
==13622==
==13622== 716,480 (45,760 direct, 670,720 indirect) bytes in 220 blocks are definitely lost in loss record 87 of 87
==13622== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==13622== by 0x6E7A10C: PQmakeEmptyPGresult (in /usr/lib/x86_64-linux-gnu/libpq.so.5.9)
==13622== by 0x6E85607: ??? (in /usr/lib/x86_64-linux-gnu/libpq.so.5.9)
==13622== by 0x6E7C1D7: PQgetResult (in /usr/lib/x86_64-linux-gnu/libpq.so.5.9)
==13622== by 0x6E7C52C: ??? (in /usr/lib/x86_64-linux-gnu/libpq.so.5.9)
==13622== by 0xC460B2F: ???
==13622== by 0xC258056: ???
==13622== by 0x1171BD: parse_pay (taler-merchant-httpd_pay.c:1049)
==13622== by 0x11816D: handler_pay_json (taler-merchant-httpd_pay.c:1291)
==13622== by 0x118E74: MH_handler_pay (taler-merchant-httpd_pay.c:1494)
==13622== by 0x10CBBF: url_handler (taler-merchant-httpd.c:234)
==13622== by 0x586E82E: call_connection_handler (connection.c:1929)
==13622==
Steps To ReproduceRun under valgrind while using:

$ taler-merchant-generate-payments -n 1000 -e -m
TagsNo tags attached.

Activities

Christian Grothoff

2017-06-04 23:36

manager   ~0012225

merchant backend and library no longer leak but the _payments generator_ itself still leaks like a sieve:

valgrind --leak-check=yes bin/taler-merchant-generate-payments -n 10 -e -m

==20372== LEAK SUMMARY:
==20372== definitely lost: 11,849 bytes in 148 blocks
==20372== indirectly lost: 133,751 bytes in 2,451 blocks
==20372== possibly lost: 0 bytes in 0 blocks
==20372== still reachable: 4,826 bytes in 74 blocks
==20372== suppressed: 0 bytes in 0 blocks

Christian Grothoff

2017-06-05 00:05

manager   ~0012226

No more leaks as of a2793a5..31b7acf

Issue History

Date Modified Username Field Change
2017-05-14 15:50 Christian Grothoff New Issue
2017-05-14 15:50 Christian Grothoff Status new => assigned
2017-05-14 15:50 Christian Grothoff Assigned To => Marcello Stanisci
2017-06-04 22:24 Christian Grothoff Assigned To Marcello Stanisci => Christian Grothoff
2017-06-04 23:36 Christian Grothoff Note Added: 0012225
2017-06-05 00:05 Christian Grothoff Status assigned => resolved
2017-06-05 00:05 Christian Grothoff Resolution open => fixed
2017-06-05 00:05 Christian Grothoff Fixed in Version => 0.3
2017-06-05 00:05 Christian Grothoff Note Added: 0012226
2017-06-05 00:05 Christian Grothoff Target Version 0.5 => 0.3
2017-06-06 14:18 Christian Grothoff Status resolved => closed