-
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 when date format is incorrect #239
Comments
I don't really get this syntax. Where do you put this and how does it relate to carbon-c-relay? |
@grobian I should have been more clear - those are shell scripts that act as "emitters" to send fake metrics to carbon-c-relay. When you send the timestamp as time since unix epoch in milliseconds it causes carbon-c-relay to segfault. I am presuming that this is an integer overflow. |
Interesting. Could you please post your configuration and check what those
emitters are actually sending? Check with tcpdump or start 'nc -v -k -l
someport' and let the emitter send there.
Op vr 9 dec. 2016 16:56 schreef poblahblahblah <[email protected]>:
… @grobian <https://github.com/grobian> I should have been more clear -
those are shell scripts that act as "emitters" to send fake metrics to
carbon-c-relay.
When you send the timestamp as time since unix epoch in milliseconds it
causes carbon-c-relay to segfault. I am presuming that this is an integer
overflow.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#239 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACxrWhtXKEcNaGfgDAh0GhXJkxmZz8AXks5rGXofgaJpZM4LIHvM>
.
|
carbon-c-relay config:
version: Here is an example of a emitter sending something good (using netcat as a "listener"):
Here is an example of an emitter sending something that causes carbon-c-relay to crash:
So, yeah - sending the timestamp in milliseconds causes carbon-c-relay to segfault. I know clients out there are able to send in millisecond resolution even though it's not supported by carbon-c-relay, so it seems like a misconfigured client could pretty easily bring down a carbon-c-relay based setup. |
ok, this is an aggregator problem then, will have a look. |
I tried your example, it doesn't crash for me. I've checked the code, and it does bounds checking, so a crash on this is not expected either. |
A stacktrace would be very helpful here, if possible. |
I tried reproducing once again, but no matter what I try, no crack. |
sorry, @grobian was busy with work, then on vacation. How would I go about getting a stacktrace? I can still trigger the crash locally on 2.3 and the recently released 2.4. |
Ok, is it possible for you to compile carbon-c-relay yourself? If so, use CFLAGS="-g". Then run the relay in gdb, like gdb --args ./relay . When it crashes, type thread apply all bt -- that should give the information I'm looking for. |
@grobian is this what you are looking for:
|
YES! Thank you!!! |
This should be the fix for issue #239. The bucket position was calculated in a temp variable which was not big enough to hold the result. Likely the truncated value fitted in the position list, but the bucket wasn't initialised yet.
Can you try if my latest commit changes anything for you? After pushing I got a bit sceptical whether or not I found the issue. |
@grobian Everything looks good on the latest commit. Here is the netcat output that carbon-c-relay is relaying to:
|
@grobian also, thanks a lot for the fix and for carbon-c-relay! |
So, are you happy with this behaviour? (It should drop the metric with a message about being too much in the future or something) If this is ok for you, I'll close this and release 2.5 soon. |
Yeah, this behavior is fine with me. |
Hello,
I am currently testing out carbon-c-relay and had accidentally configured the metric emitter to send a higher resolution timestamp (milliseconds rather than seconds) than I meant to. This resulted in a segfault from carbon-c-relay.
This results in a segfault:
This is fine and works as expected:
I am on CentOS7.2, using carbon-c-relay 2.3. I also tested this against HEAD in master and it caused a segfault there as well.
The text was updated successfully, but these errors were encountered: