fix(outputs.postgresql): report a missing table instead of panicking - #19608
Open
arpitjain099 wants to merge 1 commit into
Open
fix(outputs.postgresql): report a missing table instead of panicking#19608arpitjain099 wants to merge 1 commit into
arpitjain099 wants to merge 1 commit into
Conversation
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
Contributor
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
Member
|
Thanks for your contribution @arpitjain099! Can you please restore the PR description template, especially the AI section, as we cannot review or merge your PR otherwise... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #19501.
RenderbuildsallColumnswithtcs.Concat(table.Columns)without checkingtable, andNewTablereturns nil whenever the table name is empty. A nil table therefore segfaults inside the template render and takes the agent down, which is the crash in the report:I reproduced that exact frame from a unit test by handing
Renderthe nil thatNewTable("", "", nil)returns, so it is reachable from any caller that ends up with an empty table name, not only through the reported configuration.Rendernow returnscannot render template without a tableinstead. The write then fails the way any other schema error does, gets logged by the table manager, and the agent keeps running.To be clear about the scope: this stops the crash and turns it into a reportable error, but it does not explain how the table state reaches
updatewith an empty name in the reporter's setup. That is worth chasing separately, and this change makes it visible in the logs instead of a stack trace.TestRenderWithoutTablecovers both directions, the nil table erroring and an ordinary table still rendering. It panics on master rather than failing.go test ./plugins/outputs/postgresql/...passes.