[pgpool-hackers: 4462] Segmentation fault on error at parsing config file
Carlos Chapi
cchapi at systemguards.com.ec
Thu May 30 07:05:06 JST 2024
If there's a syntax error in pgpool.conf like:
listen_addresses = '*
(without closing single quotes) trying to start pgpool results in a
Segmentation Fault instead of a parsing error. Here's the backtrace:
Core was generated by `/usr/bin/pgpool -f /etc/pgpool-II/pgpool.conf -n'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 pfree (pointer=0x7f524ce70bc0) at parser/../../src/utils/mmgr/mcxt.c:956
956 (*context->methods->free_p) (context, pointer);
(gdb) bt full
#0 pfree (pointer=0x7f524ce70bc0) at parser/../../src/utils/mmgr/mcxt.c:956
context = 0x0
#1 FreeConfigVariable (item=0x7f524ce70c08) at config/pool_config.l:287
No locals.
#2 FreeConfigVariables (list=<optimized out>) at config/pool_config.l:305
next = 0x0
item = 0x7f524ce70c08
#3 ParseConfigFile (config_file=<optimized out>,
calling_file=calling_file at entry=0x0, depth=depth at entry=0,
elevel=elevel at entry=21, head_p=head_p at entry=0x7ffc7a650d50,
tail_p=tail_p at entry=0x7ffc7a650d48) at config/pool_config.l:465
fd = 0x560db343af50
lex_buffer = 0x560db343b130
token = 8
key = <optimized out>
val = <optimized out>
item = <optimized out>
buf = "/etc/pgpool-II\000pgpool.conf", '\000' <repeats 5998
times>...
config_filepath = 0x7f524ce70b00 "/etc/pgpool-II/pgpool.conf"
#4 0x0000560db2501e2a in pool_get_config (config_file=<optimized out>,
context=CFGCXT_INIT) at config/pool_config.l:485
head_p = 0x7f524ce70b90
tail_p = 0x7f524ce70c08
res = <optimized out>
elevel = 21
#5 0x0000560db24f1417 in main (argc=<optimized out>, argv=<optimized out>)
at main/main.c:231
opt = <optimized out>
debug_level = 0
optindex = 0
discard_status = 0 '\000'
clear_memcache_oidmaps = 0 '\000'
pcp_conf_file_path = "/etc/pgpool-II/pcp.conf", '\000' <repeats
8169 times>
conf_file_path = "/etc/pgpool-II/pgpool.conf", '\000' <repeats 8166
times>
hba_file_path = "/etc/pgpool-II/pool_hba.conf", '\000' <repeats
8164 times>
pool_passwd_key_file_path = '\000' <repeats 2856 times>...
long_options = {{name = 0x560db25ea865 "hba-file", has_arg = 1,
flag = 0x0, val = 97}, {name = 0x560db25e98d3 "debug", has_arg = 0, flag =
0x0, val = 100}, {name = 0x560db25ea86e "config-file", has_arg = 1, flag =
0x0, val = 102}, {
name = 0x560db25ea87a "key-file", has_arg = 1, flag = 0x0, val
= 107}, {name = 0x560db25ea883 "pcp-file", has_arg = 1, flag = 0x0, val =
70}, {name = 0x560db25ea88c "help", has_arg = 0, flag = 0x0, val = 104},
{name = 0x560db25ea606 "mode", has_arg = 1,
flag = 0x0, val = 109}, {name = 0x560db25ea891 "dont-detach",
has_arg = 0, flag = 0x0, val = 110}, {name = 0x560db25ea89d
"discard-status", has_arg = 0, flag = 0x0, val = 68}, {name =
0x560db25ea8ac "clear-oidmaps", has_arg = 0, flag = 0x0, val = 67}, {
name = 0x560db25ea8ba "debug-assertions", has_arg = 0, flag =
0x0, val = 120}, {name = 0x560db25fbb8b "version", has_arg = 0, flag = 0x0,
val = 118}, {name = 0x0, has_arg = 0, flag = 0x0, val = 0}}
It seems this was introduced on this commit:
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=25d05e55e6ebf334e768a9b454ecdb84a8a4054d
I have attached a patch to mitigate this, but I'm not entirely sure if it's
the right approach to avoiding the (possible?) memory leak with the "key"
pointer.
I'll appreciate it if anyone can take a look at the patch or the issue
overall.
Thanks,
--
Carlos Chapi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pgpool.net/pipermail/pgpool-hackers/attachments/20240529/7f453184/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: parsing.patch
Type: application/octet-stream
Size: 530 bytes
Desc: not available
URL: <http://www.pgpool.net/pipermail/pgpool-hackers/attachments/20240529/7f453184/attachment.obj>
More information about the pgpool-hackers
mailing list