-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Add serial numbers to chart names #12067
Conversation
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.
When I used the given plugin with current master
, I could replicate the issue. After this I compiled this PR, I got the expected result:
2022-02-02 02:54:52: netdata INFO : PLUGINSD[test-chart-names] : RRDSET: chart name 'cups.job_num_CT_S2000' on host 'hades' already exists.
2022-02-02 02:54:52: netdata INFO : PLUGINSD[test-chart-names] : RRDSET: using name 'cups.job_num_CT_S2000_1' for chart 'cups.job_num_CT_S2000' on host 'hades'.
2022-02-02 02:54:52: netdata INFO : PLUGINSD[test-chart-names] : RRDSET: chart name 'cups.job_size_CT_S2000' on host 'hades' already exists.
2022-02-02 02:54:52: netdata INFO : PLUGINSD[test-chart-names] : RRDSET: using name 'cups.job_size_CT_S2000_1' for chart 'cups.job_size_CT_S2000' on host 'hades'.
and netdata did not crash. LGTM!
44b6e37
to
9fdb0bd
Compare
I don't think this is the root cause here, because commenting out compute_chart_hash works fine: |
The root cause is that |
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.
I retest after last commits and everything worked as expected:
2022-02-03 13:52:37: netdata INFO : PLUGINSD[test-chart-names] : RRDSET: chart name 'cups.job_num_CT_S2000' on host 'hades' already exists.
2022-02-03 13:52:37: netdata INFO : PLUGINSD[test-chart-names] : RRDSET: using name 'cups.job_num_CT_S2000_1' for chart 'cups.job_num_CT_S2000' on host 'hades'.
2022-02-03 13:52:37: netdata INFO : PLUGINSD[test-chart-names] : RRDSET: chart name 'cups.job_size_CT_S2000' on host 'hades' already exists.
2022-02-03 13:52:37: netdata INFO : PLUGINSD[test-chart-names] : RRDSET: using name 'cups.job_size_CT_S2000_1' for chart 'cups.job_size_CT_S2000' on host 'hades'.
2022-02-03 13:52:37: netdata INFO : PLUGINSD[test-chart-names] : RRDSET: chart name 'cups.job_num_CT_S2000' on host 'hades' already exists.
2022-02-03 13:52:37: netdata INFO : PLUGINSD[test-chart-names] : RRDSET: using name 'cups.job_num_CT_S2000_2' for chart 'cups.job_num_CT/S2000' on host 'hades'.
2022-02-03 13:52:38: netdata INFO : PLUGINSD[test-chart-names] : RRDSET: chart name 'cups.job_size_CT_S2000' on host 'hades' already exists.
2022-02-03 13:52:38: netdata INFO : PLUGINSD[test-chart-names] : RRDSET: using name 'cups.job_size_CT_S2000_2' for chart 'cups.job_size_CT/S2000' on host 'hades'.
@vlvkobal can we wait until tomorrow before we merge this? I'd like to understand exactly why name remains NULL. |
@vkalintiris we were not going to merge it w/o your approval |
There's no guarantee that a collector (either internal or external) will create charts in a deterministic order and I think this PR will break the hashing optimization done in compute_chart_hash, because a different name will be assigned to a chart each time. A couple of different ideas on how to address this:
|
Does |
It will just lower a bit the probability of clashes which is already extremely low. It won't eliminate the possibility, despite it being very low, of a segmentation fault.
Why should we do that? We can just delete
It won't prevent getting the wrong output from any other collector. Netdata shouldn't crash if it gets the wrong chart name in the input. |
Summary
When charts a created with different ids which differ only by symbols that are not '_' or alphanumeric and no unique names are provided, Netdata crashes with a segmentation fault.
We will attach serial numbers to the chart names in such cases.
Fixes #12059
Test Plan
test-chart-names.plugin
in/usr/libexec/netdata/plugins.d/
, make it runnable by Netdata.