-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Fix panic when more than 32767 pipeline clients are active #38556
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
⏳ Build in-progress, with failures
Failed CI Steps
Historycc @belimawr |
⏳ Build in-progress, with failures
Failed CI StepsHistorycc @belimawr |
⏳ Build in-progress, with failures
Failed CI Stepscc @belimawr |
⏳ Build in-progress, with failures
Failed CI StepsHistorycc @belimawr |
⏳ Build in-progress, with failures
Failed CI StepsHistorycc @belimawr |
bd92336
to
4210d81
Compare
⏳ Build in-progress, with failures
Failed CI StepsHistory
cc @belimawr |
💔 Build Failed
Failed CI StepsHistory
cc @belimawr |
💔 Build Failed
Failed CI StepsHistory
cc @belimawr |
💚 Build Succeeded
History
cc @belimawr |
dc55d3e
to
f4e1b38
Compare
Pinging @elastic/elastic-agent (Team:Elastic-Agent) |
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.
Linter issues need to be fixed but the change looks good to me.
82c201a
to
81e6cc7
Compare
@elastic/obs-cloud-monitoring and @elastic/sec-deployment-and-devices could you take a look at this PR? At least at the files you own? |
cc @bturquet & @norrietaylor |
x-pack/filebeat/input/entityanalytics/internal/kvstore/input.go
Outdated
Show resolved
Hide resolved
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.
awscloudwatch and awss3 input change looks good to me.
@belimawr @pierrehilbert when this one is addressed I am pressing the approve button. Also I would propose to have an entry in |
I added some changelog entries in 85e42dd |
Refactor tests so they do not depend on `client.closeRef`
Remove all references to CloseRef, including the ones that were commented out.
The pipeline client used in some tests could not have its Close method called more than once, given the changes introduces in the previous commits, some test scenarios called it more than once. This is fixed by using a sync.Once in ChanClient.Close.
Fix number of clients to close, add some comments and better name a variable.
This pull request is now in conflicts. Could you fix it? 🙏
|
a1c018c
to
85e42dd
Compare
Folks, given the PR is pretty much approved, all comments have been addressed and I'm going on PTO, I've enabled auto-merge. |
Proposed commit message
The publishing pipeline would panic when more than 32767 clients were active, that happened because each client would add two channels to a slice and an infinity loop would use
reflect.Select
on this list.reflect.Select
supports a maximum of 65536 cases, if there are more it panics.This PR fixes this by removing the need for this list. The pipeline used an infinity loop to detect if the
CloseRef
from the pipeline client was closed, if it happened, then it would callclient.Close
. By analysing the code settingCloseRef
we identified there was no need for the pipeline to be responsible for propagating this signal, most of the times the pipeline client was created, there was already a defer to close it, in the few places where it was not present we added one.Now the pipeline is not responsible for closing any client, whomever creates a client is responsible for correctly closing it.
Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.## Author's ChecklistHow to test this PR locally
This PR fixes a bug by removing a feature that is not needed. That said, it is easy to reproduce the situation that would lead to the crash.
All configuration files and scripts are at the end of this section.
./gen-logs.sh 33000
filebeat.yml
wc -l output*.ndjson
, it should report 33.000.000 entries.rm -rf /tmp/too-many-logs
filebeat.yml
Related issues
## Use cases## Screenshots## Logs