-
Notifications
You must be signed in to change notification settings - Fork 107
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 in v3.4 #346
Comments
Hi, I agree that this doesn't look good. Can you share the server configuration for this particular instance? |
carbon-c-relay started with parameters Metric sended over UDP and TCP Configuration file cluster alert match * match [0-9A-Fa-f]{8}-?[0-9A-Fa-f]{4}-?[0-9A-Fa-f]{4}-?[0-9A-Fa-f]{4}-?[0-9A-Fa-f]{12} match * |
Ah, so it shouldn't do udp at all, am I correct? |
Some metric sended over UDP. More metric sended over UDP. I check source code and found one place that may be a problem source. It's a allocation or assignment for connections[c].strm->hdl.udp.srcaddr One place with this code started from dispatcher.c:615. May be error on lsnr check ?
.. |
Yes, you're right. So you have a UDP listener setup, is that correct? |
No listener configured, so If no listen directive is present, the relay will use the default listeners for port 2003 on tcp and udp, plus the unix socket /tmp/.s.carbon-c-relay.2003 |
Trace with ASAN 0x7f16b52e9811 is located 17 bytes inside of 68247552-byte region [0x7f16b52e9800,0x7f16b93ff800) Realloc of connections is a root cause of segfault I see 2 ways for fix this:
|
…alloc Fixes issue #346. Signed-off-by: Fabian Groffen <[email protected]>
Thanks, the realloc indeed is the problem, I applied your patch! |
Signed-off-by: Fabian Groffen <[email protected]>
Hello.
I get segfault for version 3.4. Synthetic test with UDP packets don't reproduce crash. May be problem near dispatcher.c:615 ? And istead ofcode block from 621 line executed code from line 617
[5435108.569811] carbon-c-relay[7083]: segfault at 7fa43d80d8d1 ip 00005589bfd469e0 sp 00007fa43affecc0 error 6 in carbon-c-relay[5589bfd3f000+25000]
(gdb) bt
#0 0x0000558da623e9e0 in udpsockread (strm=0x558da75d1400, buf=, sze=) at dispatcher.c:162
#1 0x0000558da623fcf3 in dispatch_connection (start=..., self=0x558da75b8c00, conn=0x7fa05dddb8c0) at dispatcher.c:813
#2 dispatch_runner (arg=) at dispatcher.c:1091
#3 0x00007fa0d8067e25 in pthread_mutex_timedlock () from /lib64/libpthread.so.0
#4 0x0000000000000000 in ?? ()
(gdb) list
157 ret = recvfrom(s->sock, buf, sze, 0, (struct sockaddr )&s->saddr, &slen);
158 if (ret <= 0)
159 return ret;
160
161 / figure out who's calling */
162 s->srcaddr[0] = '\0';
163 switch (s->saddr.sin6_family) {
164 case PF_INET:
165 inet_ntop(s->saddr.sin6_family,
166 &((struct sockaddr_in *)&s->saddr)->sin_addr,
(gdb) p_v strm
"strm" = (z_strm ) <0x558da75d1400> { ptr = {
"strmread" = (ssize_t ()(struct _z_strm *, void , size_t)) <0x558da623e9a0>,
"strmclose" = (int ()(struct _z_strm *)) <0x558da623e940>,
"hdl" = (union {...}) <0x558da75d1410> {
"sock" = (int) 10,
"udp" =
(struct udp_strm) <0x558da75d1410> {sock = 10, saddr = {sin6_family = 2, sin6_port = 51495, sin6_flowinfo = 3066564910, sin6_addr = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0, 0, 0}}}, sin6_scope_id = 0},
srcaddr = 0x7fa0ab6b58d1 <error: Cannot access memory at address 0x7fa0ab6b58d1>,
srcaddrlen = 24
},
},
"ibuf" = (char [8192]) <0x558da75d1440> { str_len:0 [0:399] = "" + \0 },
"ipos" = (short unsigned int) 0,
"nextstrm" = (struct _z_strm *) <0x0>,
} }
The text was updated successfully, but these errors were encountered: