-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[core.logging] Fix issue where logs fail to calculate size of gunzip streams. #90353
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
Conversation
|
Pinging @elastic/kibana-core (Team:Core) |
TinaHeiligers
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought: Should we add the Node process warning that's causing the issue to out allow list to prevent future issues?
Code and fix LGTM!
| !isBoom(res) && | ||
| res.variety === 'stream' && | ||
| res.source === src && | ||
| res.source instanceof ReadStream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion but not a blocker: add an inline comment as to why we need to explicitly check the instance type:
| res.source instanceof ReadStream | |
| res.source instanceof ReadStream // prevent zlib's Gunzip streams through |
jen-huang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't read code but tested locally and Fleet UI is working normally now 👍🏻 Thanks for the quick fix!
I had considered that, but this is a fairly specific issue to logging -- AFAICT nowhere else in Kibana is attempting to read This was a perfect storm of making a change to a low-level part of the platform that touches everything, and having one particular area of Kibana that didn't have functional test coverage which happened to be using a different type of stream (and which I also didn't happen to test manually). |
💚 Build SucceededMetrics [docs]
To update your PR or re-run it, just comment with: |
| }); | ||
|
|
||
| test('returns undefined when source is not plain object', () => { | ||
| const result = getResponsePayloadBytes([1, 2, 3]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems to be a valid use-case when you want to respond with an array of objects. isn't it? @lukeelmers
After #87939 was merged, @jen-huang noticed that the visiting the
Fleet > IntegrationsUI would cause the Kibana server to crash with a message from the logging system:The issue came from
get_response_payload, where we are attempting to calculate the size of the http response payload for logging purposes. In this case theisFsReadStreamtype guard was incorrectly letting zlib'sGunzipstreams through as there wasn't an explicitinstanceof ReadStreamcheck. Since gunzip is only used a few places in Kibana (which apparently don't have functional test coverage?), this went unnoticed.Normally this would be fine since we swallow any payload calculation errors in a
try/catchas this is not mission-critical info. However, it just so happens thatbytesReadis a deprecated method in zlib which will emit a Node process warning.And normally that would be fine too, except we intentionally exit the process on any Node warning that isn't explicitly on our allow list. My understanding is that this only happens while in dev mode, so a temporary workaround until this PR is merged would be running
node --no-warnings scripts/kibana serve --dev.While I'd like to incorporate payload size calculation for gunzip streams, I'm opening this PR with an immediate fix in the interim so that Fleet is no longer broken on
master:instanceof ReadStreamisObjectchecks were also not strict enough and letting too much through, so I used lodashisPlainObjectfor those instead