elastic / elastic/logstash

Public Methods on `org.logstash.ackedqueue.Queue` Should Throw `IllegalStateException` before `open` or `recover` was Called on the Queue

Open
#7,026 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
14.9k
Forks
3.5k
Avg merge
1d 4h
Merged PRs (30d)
88

Description

It's in the title. Before `open` was called on a `Queue` the object is not in a usable state.

`write`ing to it will cause an NPE to be thrown.
The return of `org.logstash.ackedqueue.Queue#getPersistedByteSize` will be `0` even when this is not necessarily true. (In hindsight #7023 ) not a good approach.

A random issue where this actually came through: https://github.com/elastic/logstash/issues/7022.
Also, note that this should be fixed before #6998 to ensure the stability of the process of determining necessary free disk space from the existing persisted data.

Contributor guide

Open the contributing guide

Research direction

Start with org.logstash.ackedqueue.Queue and inspect its public methods, especially write and getPersistedByteSize, along with the open and recover lifecycle. Reproduce calls made before initialization and verify that every applicable public method consistently throws IllegalStateException instead of exposing invalid state or an NPE.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.