Closed StephenPCG closed 7 years ago
ok, wow
Any chance you could send me a stacktrace? I can't seem to reproduce this.
I'm glad to, but I am not very familiar with C, can you give me some instructions on how to print the stacktrace? I'm familiar with linux tools, you can just give me some commands or tell me what modifications I need to make to the code, I can master it.
If you use docker, you can try to reproduce in this way:
$ cat Dockerfile
FROM centos:7
MAINTAINER Stephen Zhang <stephenpcg@gmail.com>
RUN yum install -y make gcc git \
&& cd /root \
&& git clone -b master --depth 1 https://github.com/grobian/carbon-c-relay.git \
&& cd carbon-c-relay \
&& make relay
CMD ["/root/carbon-c-relay/relay", "-f", "/relay.conf"]
$ cat relay.conf
cluster default
forward
127.0.0.1:1234
;
match *
send to
default
stop
;
$ docker built -t carbon .
$ docker run -it -v $PWD/relay.conf:/relay.conf -p 2003:2003 carbon
And then send some metric in. It crashes here.
try this:
make CFLAGS="-g -O0 -pipe" relay
Then run it under gdb like this:
gdb --args /root/carbon-c-relay/relay -f /relay.conf
(basically add "gdb", "--args"
at the front of your CMD array)
Then when run
from gdb, trigger the crash and run thread all apply bt
Here's the output:
$ gdb --args ./relay -f /relay.conf
...
(gdb) r
...
[New Thread 0x7ffff63ea700 (LWP 128)]
[2017-03-21 13:47:05] starting 4 workers
[New Thread 0x7ffff5be9700 (LWP 129)]
[New Thread 0x7ffff53e8700 (LWP 130)]
[New Thread 0x7ffff4be7700 (LWP 131)]
[New Thread 0x7ffff43e6700 (LWP 132)]
[New Thread 0x7ffff3be5700 (LWP 133)]
[2017-03-21 13:47:05] starting statistics collector
[New Thread 0x7ffff33e4700 (LWP 134)]
[2017-03-21 13:47:05] starting servers
[New Thread 0x7ffff2be3700 (LWP 135)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff2be3700 (LWP 135)]
__GI_getaddrinfo (name=0x62b430 "127.0.0.1", service=0x7ffff2be2e40 "1234", hints=0x62b930000000, pai=0x7ffff2be2e48)
at ../sysdeps/posix/getaddrinfo.c:2344
2344 if (hints->ai_flags
(gdb)
thanks, can you try my latest commit to see if that helps?
It's working now!
cool :)
Version: e749aee (current master) config file (this time I just copy and paste without any modification):
I started a docker container from centos:7 to have a clean environment. Inside the container, I cloned code, compile and run, the output:
Segmentation fault happens when I send a metric with the following command: