Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault on reload after remove shard from any_of cluster #381

Closed
msaf1980 opened this issue Sep 26, 2019 · 0 comments
Closed

Segfault on reload after remove shard from any_of cluster #381

msaf1980 opened this issue Sep 26, 2019 · 0 comments

Comments

@msaf1980
Copy link
Contributor

Step to reproduce:

  1. Add cluster with some nodes

cluster clickhouse
any_of
127.0.0.1:2113 127.0.0.1:2013 127.0.0.1:2213
;

  1. Start relay
  2. Remove node from cluster

cluster clickhouse
any_of
127.0.0.1:2113 127.0.0.1:2213
;

  1. Send SIGHUP to relay process

ASAN reports:
==25799==ERROR: AddressSanitizer: heap-use-after-free on address 0x606000000b64 at pc 0x0000004c1d28 bp 0x7ffe80bd4df0 sp 0x7ffe80bd4de0
READ of size 4 at 0x606000000b64 thread T0
#0 0x4c1d27 in router_contains_listener /data/git/carbon-c-relay/router.c:2320
#1 0x404bf7 in do_reload /data/git/carbon-c-relay/relay.c:242
#2 0x40503e in handle_signal /data/git/carbon-c-relay/relay.c:324
#3 0x409ce9 in main /data/git/carbon-c-relay/relay.c:1022
#4 0x7fa0997ac11a in __libc_start_main (/lib64/libc.so.6+0x2311a)
#5 0x404089 in _start (/data/git/carbon-c-relay/relay+0x404089)

0x606000000b64 is located 4 bytes inside of 64-byte region [0x606000000b60,0x606000000ba0)
freed by thread T0 here:
#0 0x7fa09beafc40 in __interceptor_free (/lib64/libasan.so.5+0xeec40)
#1 0x7fa09986d747 in __GI_freeaddrinfo (/lib64/libc.so.6+0xe4747)

previously allocated by thread T0 here:
#0 0x7fa09beb0008 in malloc (/lib64/libasan.so.5+0xef008)
#1 0x7fa09986bece in gaih_inet.constprop.7 (/lib64/libc.so.6+0xe2ece)
#2 0x7fa09986d883 in __GI_getaddrinfo (/lib64/libc.so.6+0xe4883)
#3 0x7fa09be77640 (/lib64/libasan.so.5+0xb6640)
#4 0x4a2018 in router_validate_address /data/git/carbon-c-relay/router.c:452
#5 0x4b05b8 in router_readconfig /data/git/carbon-c-relay/router.c:1368
#6 0x407d01 in main /data/git/carbon-c-relay/relay.c:869
#7 0x7fa0997ac11a in __libc_start_main (/lib64/libc.so.6+0x2311a)

SUMMARY: AddressSanitizer: heap-use-after-free /data/git/carbon-c-relay/router.c:2320 in router_contains_listener

msaf1980 pushed a commit to msaf1980/carbon-c-relay that referenced this issue Sep 30, 2019
Clear saddr member such that subsequent accesses detect the member has
been freed in order to avoid heap-use-after-free.

Thanks msaf1980 for reporting.

Closes: grobian#381
msaf1980 pushed a commit to msaf1980/carbon-c-relay that referenced this issue Oct 9, 2019
Clear saddr member such that subsequent accesses detect the member has
been freed in order to avoid heap-use-after-free.

Thanks msaf1980 for reporting.

Closes: grobian#381
msaf1980 pushed a commit to msaf1980/carbon-c-relay that referenced this issue Oct 23, 2019
Clear saddr member such that subsequent accesses detect the member has
been freed in order to avoid heap-use-after-free.

Thanks msaf1980 for reporting.

Closes: grobian#381
msaf1980 pushed a commit to msaf1980/carbon-c-relay that referenced this issue Jan 20, 2020
Clear saddr member such that subsequent accesses detect the member has
been freed in order to avoid heap-use-after-free.

Thanks msaf1980 for reporting.

Closes: grobian#381
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant