grobian / carbon-c-relay

Enhanced C implementation of Carbon relay, aggregator and rewriter
Apache License 2.0
380 stars 107 forks source link

v3.5 segfaults when configured with ssl #388

Closed frostmar closed 4 years ago

frostmar commented 4 years ago

Hi,

I'm getting a segfault with v3.5 when the first metric is received over TCP, when configured to listen with ssl. I'm not sure if this is known about (or already fixed in master?) as it's similar to a comment on a bountysource issue


I'm using v3.5 source, built in an ubuntu:18.04 docker container, with libssl-dev 1.1.1 and gcc 7.4.0.

A stack from gdb with a debug build (CFLAGS="-g") shows:

Thread 2 "relay" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff68b8700 (LWP 4591)]
0x00007ffff7b7d970 in SSL_get_rbio () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
(gdb)
(gdb) bt
#0  0x00007ffff7b7d970 in SSL_get_rbio () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#1  0x00007ffff7b7d9b8 in SSL_set_bio () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#2  0x00007ffff7b7db9f in SSL_set_fd () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#3  0x000055555555e8ce in dispatch_addconnection (sock=7, lsnr=0x7ffff7fab300) at dispatcher.c:674
#4  0x000055555555f88b in dispatch_runner (arg=0x5555557b3490) at dispatcher.c:1100
#5  0x00007ffff6ec36db in start_thread (arg=0x7ffff68b8700) at pthread_create.c:463
#6  0x00007ffff6bec88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

... which seems similar to what's mentioned here: https://www.bountysource.com/issues/76745197-segmentation-fault-in-server_queuereader-d-0x5555557b29f0-at-server-c-875

The config used included:

listen
  type linemode
  transport plain ssl /tmp/certificate/combined.crt
  *:2003 proto tcp;

Please let me know if there's any more diagnostics that would help track this down.

frostmar commented 4 years ago

For now I've downgraded to v3.4, which is working well

using marginally different config syntax:

listen
  type linemode
  transport ssl /tmp/certificate/combined.crt
  *:2003 proto tcp;
grobian commented 4 years ago

Yes, bountysource copied issue #368, which was fixed after v3.5. I think this is a duplicate. My bad for letting it rot since early this year.

grobian commented 4 years ago

released the fix in v3.6