-
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
[Filebeat] cel input does not stop after SIGINT #33962
Comments
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
I have seen essentially the same behaviour with packetbeat, so I am not sure that this is specific to CEL. The behaviour is that on the first ^C the beat attempts to start the shutdown sequence but the input keeps trying and on subsequent ^C the signal handlers are no longer responsive at all since presumably they have been removed during the shutdown sequence. |
When Filebeat gets a SIGINT it will pass this down to the inputs via the Footnotes |
Similar result with packetbeat.
In both cases it's necessary to send SIGKILL to get them to exit. |
From the common indifference that they both have, I suspect this is deeper than CEL. |
There's probably an issue with Packetbeat as well 😢 . It seems like the go-retryablehttp is continuing despite the ctx being cancelled. Are the underlying HTTP requests made from the CEL program tied into the evaluator's context (e.g. the one from Then after go-retryablehttp gives up and control returns to here 1 the error is not a Footnotes
|
Currently the context is not passed to the underlying HTTP client unless it uses OAuth2, in which case it is handed over that way. It looks like the lib.HTTP invocation will need to have a ctx param. I'll add that today. |
There is a quick fix though that doesn't need that and should be put in as well. diff --git a/x-pack/filebeat/input/cel/input.go b/x-pack/filebeat/input/cel/input.go
index 0cd3609716..034a2b6ee6 100644
--- a/x-pack/filebeat/input/cel/input.go
+++ b/x-pack/filebeat/input/cel/input.go
@@ -187,6 +187,13 @@ func (input) run(env v2.Context, src *source, cursor map[string]interface{}, pub
return ctx.Err()
case <-time.After(wait):
}
+ } else {
+ // Exit if we have been cancelled.
+ select {
+ case <-ctx.Done():
+ return ctx.Err()
+ default:
+ }
}
// Process a set of event requests. |
When testing the CEL input against an HTTP host that is down, the CEL input does not return after a Ctrl+C / SIGINT.
Version: filebeat version 8.7.0 (arm64), libbeat 8.7.0 [ea9b0cb built 2022-12-06 16:22:31 +0000 UTC]
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: