-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
out_cloudwatch seems to have an integer overflow problem with timestamps on ARMv7 #3640
Comments
Thanks for this detailed report! |
No problem! We're all developers here... With a bit of experimentation, it seems this fixes it: event->timestamp = (unsigned long long) (tms->tm.tv_sec * 1000ull + though I'm not sure how precious you are about relying on C99 syntax. I guess the same kind of compiler hint could be had by casting the literal (or Of course there may be other places in fluent-bit where timestamps are mishandled with the timespec values being 32 bits. A casual grep didn't find any similar multiplications in other drivers. Ultimately I guess running the test suite on ARMv7 may help discover these. I wasn't sure whether the test suite would catch this bug as it stands. I haven't tried yet. I'm happy to work on a PR for this with a bit of guidance if you like. |
@nbertram Please do open a PR. Eduardo can help with/comment on the right way to do this in the PR. Unfortunately cross platform/compiler support is a little bit outside of my area of expertise. There is CI set up on pull requests against the master branch, which tests with a bunch of different compilers and architectures IIRC. If your suggested change passes that, and Eduardo's review, then we're good to go. I will make sure he sees this PR. The contributing guide says that in general we follow these recommendations, not sure if any of that applies here: https://httpd.apache.org/dev/styleguide.html |
…g tv_sec to millis (fluent#3640)
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
…g tv_sec to millis (fluent#3640) Signed-off-by: Neil Bertram <[email protected]>
…g tv_sec to millis (#3640) Signed-off-by: Neil Bertram <[email protected]>
Bug Report
Describe the bug
I'm using a custom build (off master) of fluent-bit on armhf (ARMv7, 32-bit) and am unable to ship logs to Cloudwatch. I have checked the parsing with the stdout output and note the timestamp is correctly parsed, but if outputting to Cloudwatch all the lines are rejected as "too old".
After sticking mitmproxy into the mix, I can see the message to Cloudwatch is something like this:
which generates this error:
The timestamp in the JSON, 252251535, falls in late Jan 1970 when taken as millis, so AWS' beef is valid.
As a wild guess, and with a bit of experimentation, it does appear that timestamps around 252251535 are a perfect 32 bit int overflow from current time, when you perform the multiplication by 1000, probably here:
fluent-bit/plugins/out_cloudwatch_logs/cloudwatch_api.c
Line 438 in 6e9a5cc
To Reproduce
On a 32-bit build of fluent-bit, try a config like this:
Expected behavior
Log entries successfully delivered to Cloudwatch.
Screenshots
N/A
Your Environment
Additional context
Tried to use the stock debs for Raspbian Buster armhf, but they caused a "Bus Error" bail on non-Raspbian, so I've built it myself. If I've built it missing flags for 32 bit compatibility, then I profusely apologise!
I'm not sure if fluent-bit actually aims for 32 bit compatibility, though because there are stock builds for ARMv7 I presumed it should work.
The text was updated successfully, but these errors were encountered: