Skip to content
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

x-pack/filebeat/input/gcppubsub: Prevent input blockage by increasing default max_outstanding_messages #38985

Merged
merged 3 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Fix panic when more than 32767 pipeline clients are active. {issue}38197[38197] {pull}38556[38556]
- Fix filestream's registry GC: registry entries are now removed from the in-memory and disk store when they're older than the set TTL {issue}36761[36761] {pull}38488[38488]
- [threatintel] MISP splitting fix for empty responses {issue}38739[38739] {pull}38917[38917]
- Prevent GCP Pub/Sub input blockage by increasing default value of `max_outstanding_messages` {issue}35029[35029] {pull}38985[38985]

*Heartbeat*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
#subscription.num_goroutines: 1

# Maximum number of unprocessed messages to allow at any time.
#subscription.max_outstanding_messages: 1000
# This must be at least queue.mem.flush.min_events to prevent input blockage.
#subscription.max_outstanding_messages: 1600

# Path to a JSON file containing the credentials and key used to subscribe.
credentials_file: ${path.config}/my-pubsub-subscriber-credentials.json
Expand Down
5 changes: 4 additions & 1 deletion x-pack/filebeat/docs/inputs/input-gcp-pubsub.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ set `subscription.max_outstanding_messages`. Default is 1.

The maximum number of unprocessed messages (unacknowledged but not yet expired).
If the value is negative, then there will be no limit on the number of
unprocessed messages. Default is 1000.
unprocessed messages. Due to the presence of internal queue, the input gets
blocked until `queue.mem.flush.min_events` or `queue.mem.flush.timeout`
is reached. To prevent this blockage, this option must be at least
`queue.mem.flush.min_events`. Default is 1600.

[float]
==== `credentials_file`
Expand Down
3 changes: 2 additions & 1 deletion x-pack/filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2964,7 +2964,8 @@ filebeat.inputs:
#subscription.num_goroutines: 1

# Maximum number of unprocessed messages to allow at any time.
#subscription.max_outstanding_messages: 1000
# This must be at least queue.mem.flush.min_events to prevent input blockage.
#subscription.max_outstanding_messages: 1600

# Path to a JSON file containing the credentials and key used to subscribe.
credentials_file: ${path.config}/my-pubsub-subscriber-credentials.json
Expand Down
4 changes: 3 additions & 1 deletion x-pack/filebeat/input/gcppubsub/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ func defaultConfig() config {
Type: "gcp-pubsub",
}
c.Subscription.NumGoroutines = 1
c.Subscription.MaxOutstandingMessages = 1000
// The input gets blocked until flush.min_events or flush.timeout is reached.
// Hence max_outstanding_message has to be at least flush.min_events to avoid this blockage.
c.Subscription.MaxOutstandingMessages = 1600
c.Subscription.Create = true
return c
}
4 changes: 2 additions & 2 deletions x-pack/filebeat/input/gcppubsub/pubsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package gcppubsub
import (
"context"
"errors"
"io/ioutil"
"io"
"net/http"
"os"
"strconv"
Expand Down Expand Up @@ -70,7 +70,7 @@ func testSetup(t *testing.T) (*pubsub.Client, context.CancelFunc) {
}
defer resp.Body.Close()

_, err = ioutil.ReadAll(resp.Body)
_, err = io.ReadAll(resp.Body)
if err != nil {
t.Fatal("failed to read response", err)
}
Expand Down
Loading