- Notifications
You must be signed in to change notification settings - Fork 3.5k
make queue_max_bytes a long again allowing queues bigger than 2GB #18366
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
Merged
+20 −6
Conversation
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
Contributor
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
Contributor
| This pull request does not have a backport label. Could you fix it @jsvd? 🙏
|
edmocosta approved these changes Oct 27, 2025
Collaborator
💚 Build Succeeded
cc @jsvd |
Member Author
| @Mergifyio backport 9.2 |
Contributor
✅ Backports have been created
|
mergify bot pushed a commit that referenced this pull request Oct 27, 2025
…8366) The queue factory setting "queueMaxBytes" used to be a long [link](https://github.com/elastic/logstash/pull/18180/files#diff-a377851670e06cd113751aa73b726b446dfb721d03d6979b9195afff7facd9f5L60): ```ruby long queueMaxBytes = RubyFixnum.num2long(args[6]); ``` But with the refactoring of #18180, it [became an Integer by mistake](https://github.com/elastic/logstash/pull/18180/files#diff-01eec670d2beabcd43041ff7fca8bc907eb227471dce886bb757b6414a655429R125): ```java .queueMaxBytes(getSetting(context, settings, QUEUE_MAX_BYTES).toJava(Integer.class)) ``` Which prevents queues being bigger than 2^31-1, causing crashes to anyone setting their PQ to 2GB or more: ```yaml queue.max_bytes: 2147483647 # 2GB-1 OK queue.max_bytes: 2147483648 # 2GB FAIL ``` This change makes queueMaxBytes a Long again, with a test confirming that queues larger than 2ˆ31-1 (max int) can be created. Without this change the new test fails: ``` ❯ bin/rspec logstash-core/spec/logstash/queue_factory_spec.rb ..F. Failures: 1) LogStash::QueueFactory when `queue.type` is `persisted` when queue.max_bytes is larger than Java int does not raise error Failure/Error: expect { queue = subject.create(settings) }.to_not raise_error expected no Exception, got #<RangeError: too big for int: 2147483648> with backtrace: # org/logstash/ackedqueue/QueueFactoryExt.java:97:in `create' # org/logstash/ackedqueue/QueueFactoryExt.java:88:in `create' # ./logstash-core/spec/logstash/queue_factory_spec.rb:85:in `block in <main>' # ./logstash-core/spec/logstash/queue_factory_spec.rb:85:in `block in <main>' # ./lib/bootstrap/rspec.rb:36:in `<main>' # ./logstash-core/spec/logstash/queue_factory_spec.rb:85:in `block in <main>' # ./lib/bootstrap/rspec.rb:36:in `<main>' Finished in 0.03879 seconds (files took 0.03787 seconds to load) 4 examples, 1 failure Failed examples: rspec ./logstash-core/spec/logstash/queue_factory_spec.rb:84 # LogStash::QueueFactory when `queue.type` is `persisted` when queue.max_bytes is larger than Java int does not raise error ``` But with the change it passes: ``` ❯ bin/rspec logstash-core/spec/logstash/queue_factory_spec.rb -fd LogStash::QueueFactory when `queue.type` is `persisted` returns a `WrappedAckedQueue` per pipeline id subdirectory creation creates a queue directory based on the pipeline id when queue.max_bytes is larger than Java int does not raise error when `queue.type` is `memory` returns a `WrappedSynchronousQueue` Finished in 0.03292 seconds (files took 0.04052 seconds to load) 4 examples, 0 failures ``` (cherry picked from commit 6c48e51)
jsvd added a commit that referenced this pull request Oct 27, 2025
…8366) (#18367) The queue factory setting "queueMaxBytes" used to be a long [link](https://github.com/elastic/logstash/pull/18180/files#diff-a377851670e06cd113751aa73b726b446dfb721d03d6979b9195afff7facd9f5L60): ```ruby long queueMaxBytes = RubyFixnum.num2long(args[6]); ``` But with the refactoring of #18180, it [became an Integer by mistake](https://github.com/elastic/logstash/pull/18180/files#diff-01eec670d2beabcd43041ff7fca8bc907eb227471dce886bb757b6414a655429R125): ```java .queueMaxBytes(getSetting(context, settings, QUEUE_MAX_BYTES).toJava(Integer.class)) ``` Which prevents queues being bigger than 2^31-1, causing crashes to anyone setting their PQ to 2GB or more: ```yaml queue.max_bytes: 2147483647 # 2GB-1 OK queue.max_bytes: 2147483648 # 2GB FAIL ``` This change makes queueMaxBytes a Long again, with a test confirming that queues larger than 2ˆ31-1 (max int) can be created. Without this change the new test fails: ``` ❯ bin/rspec logstash-core/spec/logstash/queue_factory_spec.rb ..F. Failures: 1) LogStash::QueueFactory when `queue.type` is `persisted` when queue.max_bytes is larger than Java int does not raise error Failure/Error: expect { queue = subject.create(settings) }.to_not raise_error expected no Exception, got #<RangeError: too big for int: 2147483648> with backtrace: # org/logstash/ackedqueue/QueueFactoryExt.java:97:in `create' # org/logstash/ackedqueue/QueueFactoryExt.java:88:in `create' # ./logstash-core/spec/logstash/queue_factory_spec.rb:85:in `block in <main>' # ./logstash-core/spec/logstash/queue_factory_spec.rb:85:in `block in <main>' # ./lib/bootstrap/rspec.rb:36:in `<main>' # ./logstash-core/spec/logstash/queue_factory_spec.rb:85:in `block in <main>' # ./lib/bootstrap/rspec.rb:36:in `<main>' Finished in 0.03879 seconds (files took 0.03787 seconds to load) 4 examples, 1 failure Failed examples: rspec ./logstash-core/spec/logstash/queue_factory_spec.rb:84 # LogStash::QueueFactory when `queue.type` is `persisted` when queue.max_bytes is larger than Java int does not raise error ``` But with the change it passes: ``` ❯ bin/rspec logstash-core/spec/logstash/queue_factory_spec.rb -fd LogStash::QueueFactory when `queue.type` is `persisted` returns a `WrappedAckedQueue` per pipeline id subdirectory creation creates a queue directory based on the pipeline id when queue.max_bytes is larger than Java int does not raise error when `queue.type` is `memory` returns a `WrappedSynchronousQueue` Finished in 0.03292 seconds (files took 0.04052 seconds to load) 4 examples, 0 failures ``` (cherry picked from commit 6c48e51) Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
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.
The queue factory setting "queueMaxBytes" used to be a long link:
But with the refactoring of #18180, it became an Integer by mistake:
Which prevents queues being bigger than 2^31-1, causing crashes to anyone setting their PQ to 2GB or more:
This change makes queueMaxBytes a Long again, with a test confirming that queues larger than 2ˆ31-1 (max int) can be created.
Without this change the new test fails:
But with the change it passes: