firstcloudconsulting / pqc

PostgreSQL Query Cache
http://code.google.com/p/pqc/
3 stars 0 forks source link

buffer overflow #1

Open RockyRx opened 9 years ago

RockyRx commented 9 years ago

Hiya,

Thanks for the forked version it helped a lot with long queries. Anyways I'm getting a buffer overflow error when I try to access the pool within my application (Works well in pgAdmin and other DB clients). Here's what I get in debug mode.

*** buffer overflow detected ***: pqcd: postgres test-database-20150907 192.168.1.164(58672) idle in transaction terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7338f)[0x7fcee947838f]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7fcee950fc9c]
/lib/x86_64-linux-gnu/libc.so.6(+0x109b60)[0x7fcee950eb60]
/lib/x86_64-linux-gnu/libc.so.6(__strncat_chk+0x13c)[0x7fcee950df9c]
pqcd: postgres prod-schola-database-20150907 192.168.1.164(58672) idle in transaction[0x40c674]
pqcd: postgres prod-schola-database-20150907 192.168.1.164(58672) idle in transaction[0x40d7af]
pqcd: postgres prod-schola-database-20150907 192.168.1.164(58672) idle in transaction[0x40db28]
pqcd: postgres prod-schola-database-20150907 192.168.1.164(58672) idle in transaction[0x404c6e]
pqcd: postgres prod-schola-database-20150907 192.168.1.164(58672) idle in transaction[0x403be4]
pqcd: postgres prod-schola-database-20150907 192.168.1.164(58672) idle in transaction[0x40301b]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7fcee9426ec5]
pqcd: postgres prod-schola-database-20150907 192.168.1.164(58672) idle in transaction[0x40365a]
======= Memory map: ========
00400000-0041c000 r-xp 00000000 fc:00 1197082                            /opt/pqcd-encoded/bin/pqcd
0061b000-0061c000 r--p 0001b000 fc:00 1197082                            /opt/pqcd-encoded/bin/pqcd
0061c000-0061d000 rw-p 0001c000 fc:00 1197082                            /opt/pqcd-encoded/bin/pqcd
0061d000-00625000 rw-p 00000000 00:00 0
01021000-01042000 rw-p 00000000 00:00 0                                  [heap]
01042000-01062000 rw-p 00000000 00:00 0                                  [heap]
7fcee83b4000-7fcee83cb000 r-xp 00000000 fc:00 534994                     /lib/x86_64-linux-gnu/libresolv-2.19.so
7fcee83cb000-7fcee85cb000 ---p 00017000 fc:00 534994                     /lib/x86_64-linux-gnu/libresolv-2.19.so
7fcee85cb000-7fcee85cc000 r--p 00017000 fc:00 534994                     /lib/x86_64-linux-gnu/libresolv-2.19.so
7fcee85cc000-7fcee85cd000 rw-p 00018000 fc:00 534994                     /lib/x86_64-linux-gnu/libresolv-2.19.so
7fcee85cd000-7fcee85cf000 rw-p 00000000 00:00 0
7fcee85cf000-7fcee85d4000 r-xp 00000000 fc:00 534998                     /lib/x86_64-linux-gnu/libnss_dns-2.19.so
7fcee85d4000-7fcee87d3000 ---p 00005000 fc:00 534998                     /lib/x86_64-linux-gnu/libnss_dns-2.19.so
7fcee87d3000-7fcee87d4000 r--p 00004000 fc:00 534998                     /lib/x86_64-linux-gnu/libnss_dns-2.19.so
7fcee87d4000-7fcee87d5000 rw-p 00005000 fc:00 534998                     /lib/x86_64-linux-gnu/libnss_dns-2.19.so
7fcee87d5000-7fcee87e0000 r-xp 00000000 fc:00 534996                     /lib/x86_64-linux-gnu/libnss_files-2.19.so
7fcee87e0000-7fcee89df000 ---p 0000b000 fc:00 534996                     /lib/x86_64-linux-gnu/libnss_files-2.19.so
7fcee89df000-7fcee89e0000 r--p 0000a000 fc:00 534996                     /lib/x86_64-linux-gnu/libnss_files-2.19.so
7fcee89e0000-7fcee89e1000 rw-p 0000b000 fc:00 534996                     /lib/x86_64-linux-gnu/libnss_files-2.19.so
7fcee89e1000-7fcee89e4000 r-xp 00000000 fc:00 534999                     /lib/x86_64-linux-gnu/libdl-2.19.so
7fcee89e4000-7fcee8be3000 ---p 00003000 fc:00 534999                     /lib/x86_64-linux-gnu/libdl-2.19.so
7fcee8be3000-7fcee8be4000 r--p 00002000 fc:00 534999                     /lib/x86_64-linux-gnu/libdl-2.19.so
7fcee8be4000-7fcee8be5000 rw-p 00003000 fc:00 534999                     /lib/x86_64-linux-gnu/libdl-2.19.so
7fcee8be5000-7fcee8bfb000 r-xp 00000000 fc:00 522432                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fcee8bfb000-7fcee8dfa000 ---p 00016000 fc:00 522432                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fcee8dfa000-7fcee8dfb000 rw-p 00015000 fc:00 522432                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fcee8dfb000-7fcee8f00000 r-xp 00000000 fc:00 534995                     /lib/x86_64-linux-gnu/libm-2.19.so
7fcee8f00000-7fcee90ff000 ---p 00105000 fc:00 534995                     /lib/x86_64-linux-gnu/libm-2.19.so
7fcee90ff000-7fcee9100000 r--p 00104000 fc:00 534995                     /lib/x86_64-linux-gnu/libm-2.19.so
7fcee9100000-7fcee9101000 rw-p 00105000 fc:00 534995                     /lib/x86_64-linux-gnu/libm-2.19.so
7fcee9101000-7fcee91e7000 r-xp 00000000 fc:00 1189973                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
7fcee91e7000-7fcee93e6000 ---p 000e6000 fc:00 1189973                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
7fcee93e6000-7fcee93ee000 r--p 000e5000 fc:00 1189973                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
7fcee93ee000-7fcee93f0000 rw-p 000ed000 fc:00 1189973                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
7fcee93f0000-7fcee9405000 rw-p 00000000 00:00 0
7fcee9405000-7fcee95c0000 r-xp 00000000 fc:00 535010                     /lib/x86_64-linux-gnu/libc-2.19.so
7fcee95c0000-7fcee97bf000 ---p 001bb000 fc:00 535010                     /lib/x86_64-linux-gnu/libc-2.19.so
7fcee97bf000-7fcee97c3000 r--p 001ba000 fc:00 535010                     /lib/x86_64-linux-gnu/libc-2.19.so
7fcee97c3000-7fcee97c5000 rw-p 001be000 fc:00 535010                     /lib/x86_64-linux-gnu/libc-2.19.so
7fcee97c5000-7fcee97ca000 rw-p 00000000 00:00 0
7fcee97ca000-7fcee997c000 r-xp 00000000 fc:00 522415                     /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7fcee997c000-7fcee9b7b000 ---p 001b2000 fc:00 522415                     /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7fcee9b7b000-7fcee9b96000 r--p 001b1000 fc:00 522415                     /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7fcee9b96000-7fcee9ba1000 rw-p 001cc000 fc:00 522415                     /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7fcee9ba1000-7fcee9ba5000 rw-p 00000000 00:00 0
7fcee9ba5000-7fcee9bd4000 r-xp 00000000 fc:00 1196874                    /usr/local/lib/libmemcached.so.11.0.0
7fcee9bd4000-7fcee9dd4000 ---p 0002f000 fc:00 1196874                    /usr/local/lib/libmemcached.so.11.0.0
7fcee9dd4000-7fcee9dd5000 r--p 0002f000 fc:00 1196874                    /usr/local/lib/libmemcached.so.11.0.0
7fcee9dd5000-7fcee9dd6000 rw-p 00030000 fc:00 1196874                    /usr/local/lib/libmemcached.so.11.0.0
7fcee9dd6000-7fcee9df9000 r-xp 00000000 fc:00 535007                     /lib/x86_64-linux-gnu/ld-2.19.so
7fcee9fe6000-7fcee9fec000 rw-p 00000000 00:00 0
7fcee9ff4000-7fcee9ff5000 rw-p 00000000 00:00 0
7fcee9ff5000-7fcee9ff8000 rw-p 00000000 00:00 0
7fcee9ff8000-7fcee9ff9000 r--p 00022000 fc:00 535007                     /lib/x86_64-linux-gnu/ld-2.19.so
7fcee9ff9000-7fcee9ffa000 rw-p 00023000 fc:00 535007                     /lib/x86_64-linux-gnu/ld-2.19.so
7fcee9ffa000-7fcee9ffb000 rw-p 00000000 00:00 0
7fff3984c000-7fff3986d000 rw-p 00000000 00:00 0                          [stack]
7fff399fe000-7fff39a00000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
<36 connection closed.
♥<37 connection closed.
2015-10-07 15:18:16 LOG:   pid 2134: received fast shutdown request
RockyRx commented 9 years ago

Once this buffer overflow occurs the connection got closed. And here's the error log I got fro Valgrind.

<38 connection closed.
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x54CB839: strdup (strdup.c:42)
==17924==    by 0x406C14: extract_string (pool_config.l:705)
==17924==    by 0x408290: pool_get_config (pool_config.l:559)
==17924==    by 0x402BF5: main (main.c:215)
==17924==
==17924== 9 bytes in 1 blocks are definitely lost in loss record 9 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x54CB839: strdup (strdup.c:42)
==17924==    by 0x406C14: extract_string (pool_config.l:705)
==17924==    by 0x408A2E: pool_get_config (pool_config.l:659)
==17924==    by 0x402BF5: main (main.c:215)
==17924==
==17924== 10 bytes in 2 blocks are still reachable in loss record 10 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x54CB839: strdup (strdup.c:42)
==17924==    by 0x4109F8: save_ps_display_args (ps_status.c:201)
==17924==    by 0x403BC1: fork_a_child (main.c:601)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 15 bytes in 1 blocks are possibly lost in loss record 11 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x54CB839: strdup (strdup.c:42)
==17924==    by 0x406C14: extract_string (pool_config.l:705)
==17924==    by 0x4082DE: pool_get_config (pool_config.l:257)
==17924==    by 0x402BF5: main (main.c:215)
==17924==
==17924== 16 bytes in 1 blocks are still reachable in loss record 12 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x4120AA: new_list (pool_list.c:87)
==17924==    by 0x41215C: lappend (pool_list.c:61)
==17924==    by 0x411BCB: tokenize_file (pool_hba.c:905)
==17924==    by 0x411CAA: load_hba (pool_hba.c:112)
==17924==    by 0x402CFF: main (main.c:236)
==17924==
==17924== 16 bytes in 1 blocks are still reachable in loss record 13 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x4120AA: new_list (pool_list.c:87)
==17924==    by 0x4121CC: lappend_int (pool_list.c:73)
==17924==    by 0x411BE4: tokenize_file (pool_hba.c:906)
==17924==    by 0x411CAA: load_hba (pool_hba.c:112)
==17924==    by 0x402CFF: main (main.c:236)
==17924==
==17924== 24 bytes in 1 blocks are still reachable in loss record 14 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x4120C4: new_list (pool_list.c:95)
==17924==    by 0x41215C: lappend (pool_list.c:61)
==17924==    by 0x411BCB: tokenize_file (pool_hba.c:905)
==17924==    by 0x411CAA: load_hba (pool_hba.c:112)
==17924==    by 0x402CFF: main (main.c:236)
==17924==
==17924== 24 bytes in 1 blocks are still reachable in loss record 15 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x4120C4: new_list (pool_list.c:95)
==17924==    by 0x4121CC: lappend_int (pool_list.c:73)
==17924==    by 0x411BE4: tokenize_file (pool_hba.c:906)
==17924==    by 0x411CAA: load_hba (pool_hba.c:112)
==17924==    by 0x402CFF: main (main.c:236)
==17924==
==17924== 24 bytes in 1 blocks are still reachable in loss record 16 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x4109E8: save_ps_display_args (ps_status.c:199)
==17924==    by 0x403BC1: fork_a_child (main.c:601)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 30 bytes in 1 blocks are still reachable in loss record 17 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x54CB839: strdup (strdup.c:42)
==17924==    by 0x404E44: do_child (child.c:817)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 32 bytes in 1 blocks are still reachable in loss record 18 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x4101D2: new_connection (pool_connection_pool.c:475)
==17924==    by 0x404B9F: do_child (child.c:920)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 32 bytes in 1 blocks are still reachable in loss record 19 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x40D516: ProcessFrontendResponse (pool_process_query.c:1108)
==17924==    by 0x40DA9B: pool_process_query (pool_process_query.c:334)
==17924==    by 0x404C6D: do_child (child.c:376)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 32 bytes in 1 blocks are still reachable in loss record 20 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x54CB839: strdup (strdup.c:42)
==17924==    by 0x40C6AD: SimpleForwardToBackend (pool_process_query.c:2779)
==17924==    by 0x40D7AE: ProcessFrontendResponse (pool_process_query.c:1928)
==17924==    by 0x40DB27: pool_process_query (pool_process_query.c:358)
==17924==    by 0x404C6D: do_child (child.c:376)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 32 bytes in 2 blocks are still reachable in loss record 21 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x412122: lappend (pool_list.c:130)
==17924==    by 0x411BCB: tokenize_file (pool_hba.c:905)
==17924==    by 0x411CAA: load_hba (pool_hba.c:112)
==17924==    by 0x402CFF: main (main.c:236)
==17924==
==17924== 32 bytes in 2 blocks are still reachable in loss record 22 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x412191: lappend_int (pool_list.c:130)
==17924==    by 0x411BE4: tokenize_file (pool_hba.c:906)
==17924==    by 0x411CAA: load_hba (pool_hba.c:112)
==17924==    by 0x402CFF: main (main.c:236)
==17924==
==17924== 36 bytes in 1 blocks are still reachable in loss record 23 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x54CB839: strdup (strdup.c:42)
==17924==    by 0x411CBA: load_hba (pool_hba.c:115)
==17924==    by 0x402CFF: main (main.c:236)
==17924==
==17924== 39 bytes in 1 blocks are possibly lost in loss record 24 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x54CB839: strdup (strdup.c:42)
==17924==    by 0x406C14: extract_string (pool_config.l:705)
==17924==    by 0x408986: pool_get_config (pool_config.l:643)
==17924==    by 0x402BF5: main (main.c:215)
==17924==
==17924== 40 bytes in 1 blocks are still reachable in loss record 25 of 59
==17924==    at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x404964: do_child (child.c:741)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 47 bytes in 1 blocks are definitely lost in loss record 26 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x412D28: pqc_get_cache (pqc.c:376)
==17924==    by 0x412EE9: pqc_check_cache_avail (pqc.c:175)
==17924==    by 0x409A4C: Query (pool_process_query.c:789)
==17924==    by 0x40E760: pool_process_query (pool_process_query.c:3797)
==17924==    by 0x404FF3: do_child (child.c:403)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 48 bytes in 3 blocks are still reachable in loss record 27 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x4120AA: new_list (pool_list.c:87)
==17924==    by 0x41215C: lappend (pool_list.c:61)
==17924==    by 0x411BB6: tokenize_file (pool_hba.c:904)
==17924==    by 0x411CAA: load_hba (pool_hba.c:112)
==17924==    by 0x402CFF: main (main.c:236)
==17924==
==17924== 52 bytes in 3 blocks are still reachable in loss record 28 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x54CB839: strdup (strdup.c:42)
==17924==    by 0x408C3A: pool_get_config (pool_config.l:755)
==17924==    by 0x402BF5: main (main.c:215)
==17924==
==17924== 54 bytes in 1 blocks are definitely lost in loss record 29 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x54CB839: strdup (strdup.c:42)
==17924==    by 0x406C14: extract_string (pool_config.l:705)
==17924==    by 0x408BFF: pool_get_config (pool_config.l:473)
==17924==    by 0x402BF5: main (main.c:215)
==17924==
==17924== 64 bytes in 1 blocks are still reachable in loss record 30 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x406FD2: yy_create_buffer (pool_config.c:1807)
==17924==    by 0x4074AF: yylex (pool_config.c:755)
==17924==    by 0x407F4C: pool_get_config (pool_config.l:162)
==17924==    by 0x402BF5: main (main.c:215)
==17924==
==17924== 64 bytes in 1 blocks are still reachable in loss record 31 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x40EA91: init_prepared_list (pool_process_query.c:3667)
==17924==    by 0x4048BC: do_child (child.c:135)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 64 bytes in 1 blocks are still reachable in loss record 32 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x550F32D: gaih_inet (getaddrinfo.c:1204)
==17924==    by 0x5512E0C: getaddrinfo (getaddrinfo.c:2406)
==17924==    by 0x4E466E8: _memcached_connect(memcached_instance_st*, bool) [clone .constprop.7] (connect.cc:217)
==17924==    by 0x4E49BA7: __mget_by_key_real(memcached_st*, char const*, unsigned long, char const* const*, unsigned long const*, unsigned long, bool) [clone .part
.2] (get.cc:310)
==17924==    by 0x4E4A6EB: memcached_get_by_key (get.cc:84)
==17924==    by 0x4E4A93E: memcached_get (get.cc:50)
==17924==    by 0x412DB0: pqc_get_cache (pqc.c:392)
==17924==    by 0x412EE9: pqc_check_cache_avail (pqc.c:175)
==17924==    by 0x40D14F: Execute (pool_process_query.c:933)
==17924==    by 0x40D61A: ProcessFrontendResponse (pool_process_query.c:1918)
==17924==    by 0x40DB27: pool_process_query (pool_process_query.c:358)
==17924==
==17924== 66 bytes in 11 blocks are still reachable in loss record 33 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x54CB839: strdup (strdup.c:42)
==17924==    by 0x41066C: pool_add_param (pool_params.c:142)
==17924==    by 0x40CA6B: ParameterStatus (pool_process_query.c:2912)
==17924==    by 0x4068E2: pool_do_auth (pool_auth.c:235)
==17924==    by 0x404BFD: do_child (child.c:972)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 72 bytes in 3 blocks are still reachable in loss record 34 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x4120C4: new_list (pool_list.c:95)
==17924==    by 0x41215C: lappend (pool_list.c:61)
==17924==    by 0x411BB6: tokenize_file (pool_hba.c:904)
==17924==    by 0x411CAA: load_hba (pool_hba.c:112)
==17924==    by 0x402CFF: main (main.c:236)
==17924==
==17924== 94 bytes in 14 blocks are still reachable in loss record 35 of 59
==17924==    at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x4116E7: tokenize_file (pool_hba.c:1105)
==17924==    by 0x411CAA: load_hba (pool_hba.c:112)
==17924==    by 0x402CFF: main (main.c:236)
==17924==
==17924== 94 bytes in 2 blocks are definitely lost in loss record 36 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x412D28: pqc_get_cache (pqc.c:376)
==17924==    by 0x412EE9: pqc_check_cache_avail (pqc.c:175)
==17924==    by 0x409A4C: Query (pool_process_query.c:789)
==17924==    by 0x40DDFB: pool_process_query (pool_process_query.c:2964)
==17924==    by 0x404FF3: do_child (child.c:403)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 95 bytes in 1 blocks are still reachable in loss record 37 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x54CB839: strdup (strdup.c:42)
==17924==    by 0x40D567: ProcessFrontendResponse (pool_process_query.c:1132)
==17924==    by 0x40DA9B: pool_process_query (pool_process_query.c:334)
==17924==    by 0x404C6D: do_child (child.c:376)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 96 bytes in 1 blocks are still reachable in loss record 38 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x40F947: pool_init_cp (pool_connection_pool.c:55)
==17924==    by 0x40489A: do_child (child.c:125)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 128 bytes in 1 blocks are still reachable in loss record 39 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x402F8F: main (main.c:312)
==17924==
==17924== 136 bytes in 1 blocks are still reachable in loss record 40 of 59
==17924==    at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x4049AC: do_child (child.c:761)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 176 bytes in 11 blocks are still reachable in loss record 41 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x412122: lappend (pool_list.c:130)
==17924==    by 0x411733: tokenize_file (pool_hba.c:911)
==17924==    by 0x411CAA: load_hba (pool_hba.c:112)
==17924==    by 0x402CFF: main (main.c:236)
==17924==
==17924== 178 bytes in 11 blocks are still reachable in loss record 42 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x54CB839: strdup (strdup.c:42)
==17924==    by 0x410652: pool_add_param (pool_params.c:136)
==17924==    by 0x40CA6B: ParameterStatus (pool_process_query.c:2912)
==17924==    by 0x4068E2: pool_do_auth (pool_auth.c:235)
==17924==    by 0x404BFD: do_child (child.c:972)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 188 bytes in 4 blocks are definitely lost in loss record 43 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x412B93: pqc_set_cache (pqc.c:334)
==17924==    by 0x40E9A3: pool_process_query (pool_process_query.c:482)
==17924==    by 0x404C6D: do_child (child.c:376)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 376 bytes in 8 blocks are definitely lost in loss record 44 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x412D28: pqc_get_cache (pqc.c:376)
==17924==    by 0x412EE9: pqc_check_cache_avail (pqc.c:175)
==17924==    by 0x40D14F: Execute (pool_process_query.c:933)
==17924==    by 0x40D61A: ProcessFrontendResponse (pool_process_query.c:1918)
==17924==    by 0x40DB27: pool_process_query (pool_process_query.c:358)
==17924==    by 0x404C6D: do_child (child.c:376)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 437 bytes in 7 blocks are definitely lost in loss record 45 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x54CB839: strdup (strdup.c:42)
==17924==    by 0x40C6AD: SimpleForwardToBackend (pool_process_query.c:2779)
==17924==    by 0x40D7AE: ProcessFrontendResponse (pool_process_query.c:1928)
==17924==    by 0x40DB27: pool_process_query (pool_process_query.c:358)
==17924==    by 0x404C6D: do_child (child.c:376)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 568 bytes in 1 blocks are still reachable in loss record 46 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x54B144C: __fopen_internal (iofopen.c:73)
==17924==    by 0x407F25: pool_get_config (pool_config.l:150)
==17924==    by 0x402BF5: main (main.c:215)
==17924==
==17924== 696 bytes in 1 blocks are still reachable in loss record 47 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x4E4D489: memcached_create (memory.h:75)
==17924==    by 0x41281E: pqc_init (pqc.c:55)
==17924==    by 0x402FDA: main (main.c:323)
==17924==
==17924== 815 bytes in 26 blocks are indirectly lost in loss record 48 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x54CB839: strdup (strdup.c:42)
==17924==    by 0x4109B0: save_ps_display_args (ps_status.c:175)
==17924==    by 0x403BC1: fork_a_child (main.c:601)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 1,024 bytes in 1 blocks are still reachable in loss record 49 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x40EC1A: pool_open (pool_stream.c:71)
==17924==    by 0x4101FC: new_connection (pool_connection_pool.c:467)
==17924==    by 0x404B9F: do_child (child.c:920)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 1,024 bytes in 1 blocks are still reachable in loss record 50 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x410403: pool_init_params (pool_params.c:39)
==17924==    by 0x41021C: new_connection (pool_connection_pool.c:484)
==17924==    by 0x404B9F: do_child (child.c:920)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 1,024 bytes in 1 blocks are still reachable in loss record 51 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x410416: pool_init_params (pool_params.c:45)
==17924==    by 0x41021C: new_connection (pool_connection_pool.c:484)
==17924==    by 0x404B9F: do_child (child.c:920)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 1,031 (216 direct, 815 indirect) bytes in 1 blocks are definitely lost in loss record 52 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x410999: save_ps_display_args (ps_status.c:173)
==17924==    by 0x403BC1: fork_a_child (main.c:601)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 1,168 bytes in 1 blocks are still reachable in loss record 53 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x4C2CF1F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x4E50526: memcached_server_list_append_with_weight (server_list.cc:76)
==17924==    by 0x412845: pqc_init (pqc.c:61)
==17924==    by 0x402FDA: main (main.c:323)
==17924==
==17924== 1,328 bytes in 1 blocks are still reachable in loss record 54 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x40EBCF: pool_open (pool_stream.c:51)
==17924==    by 0x4101FC: new_connection (pool_connection_pool.c:467)
==17924==    by 0x404B9F: do_child (child.c:920)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 2,048 bytes in 1 blocks are still reachable in loss record 55 of 59
==17924==    at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x40F0A8: pool_read2 (pool_stream.c:232)
==17924==    by 0x40BEE2: SimpleForwardToFrontend (pool_process_query.c:2533)
==17924==    by 0x40D263: Execute (pool_process_query.c:1026)
==17924==    by 0x40D61A: ProcessFrontendResponse (pool_process_query.c:1918)
==17924==    by 0x40DB27: pool_process_query (pool_process_query.c:358)
==17924==    by 0x404C6D: do_child (child.c:376)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 8,192 bytes in 1 blocks are still reachable in loss record 56 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x40EBF5: pool_open (pool_stream.c:61)
==17924==    by 0x4101FC: new_connection (pool_connection_pool.c:467)
==17924==    by 0x404B9F: do_child (child.c:920)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 8,192 bytes in 1 blocks are still reachable in loss record 57 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x4129C4: pqc_buf_init (pqc.c:201)
==17924==    by 0x40D860: pool_process_query (pool_process_query.c:195)
==17924==    by 0x404C6D: do_child (child.c:376)
==17924==    by 0x403BE3: fork_a_child (main.c:605)
==17924==    by 0x40301A: main (main.c:332)
==17924==
==17924== 16,386 bytes in 1 blocks are still reachable in loss record 58 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x406FEB: yy_create_buffer (pool_config.c:1807)
==17924==    by 0x4074AF: yylex (pool_config.c:755)
==17924==    by 0x407F4C: pool_get_config (pool_config.l:162)
==17924==    by 0x402BF5: main (main.c:215)
==17924==
==17924== 17,608 bytes in 1 blocks are still reachable in loss record 59 of 59
==17924==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x4C2CF1F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17924==    by 0x4E4B916: memcached_server_push (memory.h:86)
==17924==    by 0x412869: pqc_init (pqc.c:67)
==17924==    by 0x402FDA: main (main.c:323)
==17924==
==17924== LEAK SUMMARY:
==17924==    definitely lost: 1,421 bytes in 25 blocks
==17924==    indirectly lost: 815 bytes in 26 blocks
==17924==      possibly lost: 91 bytes in 8 blocks
==17924==    still reachable: 60,988 bytes in 94 blocks
==17924==         suppressed: 0 bytes in 0 blocks
==17924==
dpaks commented 9 years ago

Yeah.. Buffer overflow occurs when the result set size exceeds 1.4 MB or so (if my memory serves me right). I fixed it but I don't remember where I did the fix. Try giving a smaller query and see if this occurs.

Regards, Deepak

On Fri, Oct 9, 2015 at 11:44 AM, Oshadha Gunawardena < notifications@github.com> wrote:

Once this buffer overflow occurs the connection got closed. And here's the error log I got fro Valgrind.

<38 connection closed. ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x54CB839: strdup (strdup.c:42) ==17924== by 0x406C14: extract_string (pool_config.l:705) ==17924== by 0x408290: pool_get_config (pool_config.l:559) ==17924== by 0x402BF5: main (main.c:215) ==17924== ==17924== 9 bytes in 1 blocks are definitely lost in loss record 9 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x54CB839: strdup (strdup.c:42) ==17924== by 0x406C14: extract_string (pool_config.l:705) ==17924== by 0x408A2E: pool_get_config (pool_config.l:659) ==17924== by 0x402BF5: main (main.c:215) ==17924== ==17924== 10 bytes in 2 blocks are still reachable in loss record 10 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x54CB839: strdup (strdup.c:42) ==17924== by 0x4109F8: save_ps_display_args (ps_status.c:201) ==17924== by 0x403BC1: fork_a_child (main.c:601) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 15 bytes in 1 blocks are possibly lost in loss record 11 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x54CB839: strdup (strdup.c:42) ==17924== by 0x406C14: extract_string (pool_config.l:705) ==17924== by 0x4082DE: pool_get_config (pool_config.l:257) ==17924== by 0x402BF5: main (main.c:215) ==17924== ==17924== 16 bytes in 1 blocks are still reachable in loss record 12 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x4120AA: new_list (pool_list.c:87) ==17924== by 0x41215C: lappend (pool_list.c:61) ==17924== by 0x411BCB: tokenize_file (pool_hba.c:905) ==17924== by 0x411CAA: load_hba (pool_hba.c:112) ==17924== by 0x402CFF: main (main.c:236) ==17924== ==17924== 16 bytes in 1 blocks are still reachable in loss record 13 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x4120AA: new_list (pool_list.c:87) ==17924== by 0x4121CC: lappend_int (pool_list.c:73) ==17924== by 0x411BE4: tokenize_file (pool_hba.c:906) ==17924== by 0x411CAA: load_hba (pool_hba.c:112) ==17924== by 0x402CFF: main (main.c:236) ==17924== ==17924== 24 bytes in 1 blocks are still reachable in loss record 14 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x4120C4: new_list (pool_list.c:95) ==17924== by 0x41215C: lappend (pool_list.c:61) ==17924== by 0x411BCB: tokenize_file (pool_hba.c:905) ==17924== by 0x411CAA: load_hba (pool_hba.c:112) ==17924== by 0x402CFF: main (main.c:236) ==17924== ==17924== 24 bytes in 1 blocks are still reachable in loss record 15 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x4120C4: new_list (pool_list.c:95) ==17924== by 0x4121CC: lappend_int (pool_list.c:73) ==17924== by 0x411BE4: tokenize_file (pool_hba.c:906) ==17924== by 0x411CAA: load_hba (pool_hba.c:112) ==17924== by 0x402CFF: main (main.c:236) ==17924== ==17924== 24 bytes in 1 blocks are still reachable in loss record 16 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x4109E8: save_ps_display_args (ps_status.c:199) ==17924== by 0x403BC1: fork_a_child (main.c:601) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 30 bytes in 1 blocks are still reachable in loss record 17 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x54CB839: strdup (strdup.c:42) ==17924== by 0x404E44: do_child (child.c:817) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 32 bytes in 1 blocks are still reachable in loss record 18 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x4101D2: new_connection (pool_connection_pool.c:475) ==17924== by 0x404B9F: do_child (child.c:920) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 32 bytes in 1 blocks are still reachable in loss record 19 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x40D516: ProcessFrontendResponse (pool_process_query.c:1108) ==17924== by 0x40DA9B: pool_process_query (pool_process_query.c:334) ==17924== by 0x404C6D: do_child (child.c:376) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 32 bytes in 1 blocks are still reachable in loss record 20 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x54CB839: strdup (strdup.c:42) ==17924== by 0x40C6AD: SimpleForwardToBackend (pool_process_query.c:2779) ==17924== by 0x40D7AE: ProcessFrontendResponse (pool_process_query.c:1928) ==17924== by 0x40DB27: pool_process_query (pool_process_query.c:358) ==17924== by 0x404C6D: do_child (child.c:376) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 32 bytes in 2 blocks are still reachable in loss record 21 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x412122: lappend (pool_list.c:130) ==17924== by 0x411BCB: tokenize_file (pool_hba.c:905) ==17924== by 0x411CAA: load_hba (pool_hba.c:112) ==17924== by 0x402CFF: main (main.c:236) ==17924== ==17924== 32 bytes in 2 blocks are still reachable in loss record 22 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x412191: lappend_int (pool_list.c:130) ==17924== by 0x411BE4: tokenize_file (pool_hba.c:906) ==17924== by 0x411CAA: load_hba (pool_hba.c:112) ==17924== by 0x402CFF: main (main.c:236) ==17924== ==17924== 36 bytes in 1 blocks are still reachable in loss record 23 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x54CB839: strdup (strdup.c:42) ==17924== by 0x411CBA: load_hba (pool_hba.c:115) ==17924== by 0x402CFF: main (main.c:236) ==17924== ==17924== 39 bytes in 1 blocks are possibly lost in loss record 24 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x54CB839: strdup (strdup.c:42) ==17924== by 0x406C14: extract_string (pool_config.l:705) ==17924== by 0x408986: pool_get_config (pool_config.l:643) ==17924== by 0x402BF5: main (main.c:215) ==17924== ==17924== 40 bytes in 1 blocks are still reachable in loss record 25 of 59 ==17924== at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x404964: do_child (child.c:741) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 47 bytes in 1 blocks are definitely lost in loss record 26 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x412D28: pqc_get_cache (pqc.c:376) ==17924== by 0x412EE9: pqc_check_cache_avail (pqc.c:175) ==17924== by 0x409A4C: Query (pool_process_query.c:789) ==17924== by 0x40E760: pool_process_query (pool_process_query.c:3797) ==17924== by 0x404FF3: do_child (child.c:403) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 48 bytes in 3 blocks are still reachable in loss record 27 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x4120AA: new_list (pool_list.c:87) ==17924== by 0x41215C: lappend (pool_list.c:61) ==17924== by 0x411BB6: tokenize_file (pool_hba.c:904) ==17924== by 0x411CAA: load_hba (pool_hba.c:112) ==17924== by 0x402CFF: main (main.c:236) ==17924== ==17924== 52 bytes in 3 blocks are still reachable in loss record 28 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x54CB839: strdup (strdup.c:42) ==17924== by 0x408C3A: pool_get_config (pool_config.l:755) ==17924== by 0x402BF5: main (main.c:215) ==17924== ==17924== 54 bytes in 1 blocks are definitely lost in loss record 29 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x54CB839: strdup (strdup.c:42) ==17924== by 0x406C14: extract_string (pool_config.l:705) ==17924== by 0x408BFF: pool_get_config (pool_config.l:473) ==17924== by 0x402BF5: main (main.c:215) ==17924== ==17924== 64 bytes in 1 blocks are still reachable in loss record 30 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x406FD2: yy_create_buffer (pool_config.c:1807) ==17924== by 0x4074AF: yylex (pool_config.c:755) ==17924== by 0x407F4C: pool_get_config (pool_config.l:162) ==17924== by 0x402BF5: main (main.c:215) ==17924== ==17924== 64 bytes in 1 blocks are still reachable in loss record 31 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x40EA91: init_prepared_list (pool_process_query.c:3667) ==17924== by 0x4048BC: do_child (child.c:135) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 64 bytes in 1 blocks are still reachable in loss record 32 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x550F32D: gaih_inet (getaddrinfo.c:1204) ==17924== by 0x5512E0C: getaddrinfo (getaddrinfo.c:2406) ==17924== by 0x4E466E8: _memcached_connect(memcached_instancest, bool) clone .constprop.7 ==17924== by 0x4E49BA7: __mget_by_key_real(memcachedst, char const, unsigned long, char const const, unsigned long const, unsigned long, bool) clone .part .2 ==17924== by 0x4E4A6EB: memcached_get_by_key (get.cc:84) ==17924== by 0x4E4A93E: memcached_get (get.cc:50) ==17924== by 0x412DB0: pqc_get_cache (pqc.c:392) ==17924== by 0x412EE9: pqc_check_cache_avail (pqc.c:175) ==17924== by 0x40D14F: Execute (pool_process_query.c:933) ==17924== by 0x40D61A: ProcessFrontendResponse (pool_process_query.c:1918) ==17924== by 0x40DB27: pool_process_query (pool_process_query.c:358) ==17924== ==17924== 66 bytes in 11 blocks are still reachable in loss record 33 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x54CB839: strdup (strdup.c:42) ==17924== by 0x41066C: pool_add_param (pool_params.c:142) ==17924== by 0x40CA6B: ParameterStatus (pool_process_query.c:2912) ==17924== by 0x4068E2: pool_do_auth (pool_auth.c:235) ==17924== by 0x404BFD: do_child (child.c:972) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 72 bytes in 3 blocks are still reachable in loss record 34 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x4120C4: new_list (pool_list.c:95) ==17924== by 0x41215C: lappend (pool_list.c:61) ==17924== by 0x411BB6: tokenize_file (pool_hba.c:904) ==17924== by 0x411CAA: load_hba (pool_hba.c:112) ==17924== by 0x402CFF: main (main.c:236) ==17924== ==17924== 94 bytes in 14 blocks are still reachable in loss record 35 of 59 ==17924== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x4116E7: tokenize_file (pool_hba.c:1105) ==17924== by 0x411CAA: load_hba (pool_hba.c:112) ==17924== by 0x402CFF: main (main.c:236) ==17924== ==17924== 94 bytes in 2 blocks are definitely lost in loss record 36 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x412D28: pqc_get_cache (pqc.c:376) ==17924== by 0x412EE9: pqc_check_cache_avail (pqc.c:175) ==17924== by 0x409A4C: Query (pool_process_query.c:789) ==17924== by 0x40DDFB: pool_process_query (pool_process_query.c:2964) ==17924== by 0x404FF3: do_child (child.c:403) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 95 bytes in 1 blocks are still reachable in loss record 37 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x54CB839: strdup (strdup.c:42) ==17924== by 0x40D567: ProcessFrontendResponse (pool_process_query.c:1132) ==17924== by 0x40DA9B: pool_process_query (pool_process_query.c:334) ==17924== by 0x404C6D: do_child (child.c:376) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 96 bytes in 1 blocks are still reachable in loss record 38 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x40F947: pool_init_cp (pool_connection_pool.c:55) ==17924== by 0x40489A: do_child (child.c:125) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 128 bytes in 1 blocks are still reachable in loss record 39 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x402F8F: main (main.c:312) ==17924== ==17924== 136 bytes in 1 blocks are still reachable in loss record 40 of 59 ==17924== at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x4049AC: do_child (child.c:761) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 176 bytes in 11 blocks are still reachable in loss record 41 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x412122: lappend (pool_list.c:130) ==17924== by 0x411733: tokenize_file (pool_hba.c:911) ==17924== by 0x411CAA: load_hba (pool_hba.c:112) ==17924== by 0x402CFF: main (main.c:236) ==17924== ==17924== 178 bytes in 11 blocks are still reachable in loss record 42 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x54CB839: strdup (strdup.c:42) ==17924== by 0x410652: pool_add_param (pool_params.c:136) ==17924== by 0x40CA6B: ParameterStatus (pool_process_query.c:2912) ==17924== by 0x4068E2: pool_do_auth (pool_auth.c:235) ==17924== by 0x404BFD: do_child (child.c:972) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 188 bytes in 4 blocks are definitely lost in loss record 43 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x412B93: pqc_set_cache (pqc.c:334) ==17924== by 0x40E9A3: pool_process_query (pool_process_query.c:482) ==17924== by 0x404C6D: do_child (child.c:376) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 376 bytes in 8 blocks are definitely lost in loss record 44 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x412D28: pqc_get_cache (pqc.c:376) ==17924== by 0x412EE9: pqc_check_cache_avail (pqc.c:175) ==17924== by 0x40D14F: Execute (pool_process_query.c:933) ==17924== by 0x40D61A: ProcessFrontendResponse (pool_process_query.c:1918) ==17924== by 0x40DB27: pool_process_query (pool_process_query.c:358) ==17924== by 0x404C6D: do_child (child.c:376) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 437 bytes in 7 blocks are definitely lost in loss record 45 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x54CB839: strdup (strdup.c:42) ==17924== by 0x40C6AD: SimpleForwardToBackend (pool_process_query.c:2779) ==17924== by 0x40D7AE: ProcessFrontendResponse (pool_process_query.c:1928) ==17924== by 0x40DB27: pool_process_query (pool_process_query.c:358) ==17924== by 0x404C6D: do_child (child.c:376) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 568 bytes in 1 blocks are still reachable in loss record 46 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x54B144C: __fopen_internal (iofopen.c:73) ==17924== by 0x407F25: pool_get_config (pool_config.l:150) ==17924== by 0x402BF5: main (main.c:215) ==17924== ==17924== 696 bytes in 1 blocks are still reachable in loss record 47 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x4E4D489: memcached_create (memory.h:75) ==17924== by 0x41281E: pqc_init (pqc.c:55) ==17924== by 0x402FDA: main (main.c:323) ==17924== ==17924== 815 bytes in 26 blocks are indirectly lost in loss record 48 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x54CB839: strdup (strdup.c:42) ==17924== by 0x4109B0: save_ps_display_args (ps_status.c:175) ==17924== by 0x403BC1: fork_a_child (main.c:601) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 1,024 bytes in 1 blocks are still reachable in loss record 49 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x40EC1A: pool_open (pool_stream.c:71) ==17924== by 0x4101FC: new_connection (pool_connection_pool.c:467) ==17924== by 0x404B9F: do_child (child.c:920) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 1,024 bytes in 1 blocks are still reachable in loss record 50 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x410403: pool_init_params (pool_params.c:39) ==17924== by 0x41021C: new_connection (pool_connection_pool.c:484) ==17924== by 0x404B9F: do_child (child.c:920) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 1,024 bytes in 1 blocks are still reachable in loss record 51 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x410416: pool_init_params (pool_params.c:45) ==17924== by 0x41021C: new_connection (pool_connection_pool.c:484) ==17924== by 0x404B9F: do_child (child.c:920) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 1,031 (216 direct, 815 indirect) bytes in 1 blocks are definitely lost in loss record 52 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x410999: save_ps_display_args (ps_status.c:173) ==17924== by 0x403BC1: fork_a_child (main.c:601) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 1,168 bytes in 1 blocks are still reachable in loss record 53 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x4C2CF1F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x4E50526: memcached_server_list_append_with_weight (server_list.cc:76) ==17924== by 0x412845: pqc_init (pqc.c:61) ==17924== by 0x402FDA: main (main.c:323) ==17924== ==17924== 1,328 bytes in 1 blocks are still reachable in loss record 54 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x40EBCF: pool_open (pool_stream.c:51) ==17924== by 0x4101FC: new_connection (pool_connection_pool.c:467) ==17924== by 0x404B9F: do_child (child.c:920) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 2,048 bytes in 1 blocks are still reachable in loss record 55 of 59 ==17924== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x40F0A8: pool_read2 (pool_stream.c:232) ==17924== by 0x40BEE2: SimpleForwardToFrontend (pool_process_query.c:2533) ==17924== by 0x40D263: Execute (pool_process_query.c:1026) ==17924== by 0x40D61A: ProcessFrontendResponse (pool_process_query.c:1918) ==17924== by 0x40DB27: pool_process_query (pool_process_query.c:358) ==17924== by 0x404C6D: do_child (child.c:376) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 8,192 bytes in 1 blocks are still reachable in loss record 56 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x40EBF5: pool_open (pool_stream.c:61) ==17924== by 0x4101FC: new_connection (pool_connection_pool.c:467) ==17924== by 0x404B9F: do_child (child.c:920) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 8,192 bytes in 1 blocks are still reachable in loss record 57 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x4129C4: pqc_buf_init (pqc.c:201) ==17924== by 0x40D860: pool_process_query (pool_process_query.c:195) ==17924== by 0x404C6D: do_child (child.c:376) ==17924== by 0x403BE3: fork_a_child (main.c:605) ==17924== by 0x40301A: main (main.c:332) ==17924== ==17924== 16,386 bytes in 1 blocks are still reachable in loss record 58 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x406FEB: yy_create_buffer (pool_config.c:1807) ==17924== by 0x4074AF: yylex (pool_config.c:755) ==17924== by 0x407F4C: pool_get_config (pool_config.l:162) ==17924== by 0x402BF5: main (main.c:215) ==17924== ==17924== 17,608 bytes in 1 blocks are still reachable in loss record 59 of 59 ==17924== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x4C2CF1F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17924== by 0x4E4B916: memcached_server_push (memory.h:86) ==17924== by 0x412869: pqc_init (pqc.c:67) ==17924== by 0x402FDA: main (main.c:323) ==17924== ==17924== LEAK SUMMARY: ==17924== definitely lost: 1,421 bytes in 25 blocks ==17924== indirectly lost: 815 bytes in 26 blocks ==17924== possibly lost: 91 bytes in 8 blocks ==17924== still reachable: 60,988 bytes in 94 blocks ==17924== suppressed: 0 bytes in 0 blocks ==17924==

— Reply to this email directly or view it on GitHub https://github.com/colemanesolutions/pqc/issues/1#issuecomment-146766668 .

firstcloudconsulting commented 9 years ago

Have you tried increasing the buffer length, PQC_MAX_VALUE?

firstcloudconsulting commented 9 years ago

P.S. Yes, I added the SHA1 hashing (originally MD5 but converted to improve performance) on the SQL query and use the hash for the key to prevent throwing out long queries (reference: https://christopherjcoleman.wordpress.com/2013/08/09/code-release-postgresql-query-cache/) but I haven't worked on it in a couple of years. Any modifications, clean-up, or updates are greatly appreciated if you identify/correct the issue. Thank you!

RockyRx commented 9 years ago

@dpaks It's working fine for small queries. Only happens when a I connect it to my application which has many queries with bigger results sets

@colemanesolutions I'll take a look at it, thanks.

dpaks commented 9 years ago

So, that's exactly the problem. Please try what Christopher said. Take a look at pqc master https://github.com/dpaks/pqc-master.git where I have fixed that issue if the PQC_MAX_VALUE didn't help.

Regards, Deepak

On Fri, Oct 9, 2015 at 12:36 PM, Oshadha Gunawardena < notifications@github.com> wrote:

@dpaks https://github.com/dpaks It's working fine for small queries. Only happens when a I connect it to my application which has many queries with bigger results sets

@colemanesolutions https://github.com/colemanesolutions I'll take a look at it, thanks.

— Reply to this email directly or view it on GitHub https://github.com/colemanesolutions/pqc/issues/1#issuecomment-146774137 .