You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Retry eligible pre-write transport failures per vote and destination. Use 15-minute delays for retries one through five and 30-minute delays thereafter.
Limit pending retries to 256 pairs in receiver memory. Discard them at receiver retirement. There is no restart replay.
Recheck the destination and use current credentials on each retry. Cancel active retry sockets on retirement and avoid retrying after a write starts because delivery may already have occurred.
Verification
Focused forwarding, receiver lifecycle, protocol, and logging tests passed on Java 21 (48 tests). The retry tests stepped the scheduler through both intervals without waiting for them and covered failure isolation, DNS timeouts, credential rotation, recovery, and retirement during an active write.
The Java 21 Maven package build passed all 181 tests locally and on GitHub Actions. The fresh shaded JAR passed archive integrity checks and contains the retry classes and Bukkit, BungeeCord, and Velocity descriptors.
Independent source review approved the published range from 8e861dfd to b763d9ff.
Runtime limits
The retry worker shares the existing outbound socket limits. It schedules at most 256 pending vote–destination pairs, and when the queue is full, new failures cannot be added.
Reload or shutdown clears pending retries. The queue is RAM-only, with no restart replay. Failures after a payload write starts are terminal because the forwarding protocols provide no delivery acknowledgement.
No Minecraft runtime test was performed for Bukkit, Paper, Folia, BungeeCord, or Velocity.
Summary by CodeRabbit
New Features
Vote forwarding now retries eligible temporary failures, starting after 15 minutes and continuing every 30 minutes. Retries use the destination’s current credentials and are limited to 256 queued items.
Retries are skipped when a destination is removed, disabled, or changed, and queued retries are discarded when the service reloads or shuts down.
Documentation
Added guidance on retry timing, eligibility, terminal errors, queue limits, and when queued retries are discarded.
No actionable comments were generated in the recent review.
Walkthrough
Vote forwarding now retries eligible initial failures through a bounded queue. Retries use the saved vote and current destination credentials, stop when the destination no longer matches, and are cancelled during shutdown.
Changes: Forwarding retries
Layer / File(s)
Summary
Retry scheduling and forwarding README.md, VotifierPlus/src/main/java/com/vexsoftware/votifier/net/VoteForwarder.java, VotifierPlus/src/test/java/com/bencodez/votifierplus/tests/net/VoteForwarderRetryTest.java
VoteForwarder queues eligible initial failures within the configured limit and retries after 15 minutes for the first five attempts, then every 30 minutes. Retries check the destination configuration and use current credentials. Tests cover retry eligibility, timing, target changes, capacity, and vote snapshots. The README documents the retry rules.
Attempt admission and retirement VotifierPlus/src/main/java/com/vexsoftware/votifier/net/VoteForwarder.java, VotifierPlus/src/test/java/com/bencodez/votifierplus/tests/net/VoteForwarderHandshakeTest.java, VotifierPlus/src/test/java/com/bencodez/votifierplus/tests/net/VoteForwarderRetryTest.java
Attempt registration now uses Origin values. Shutdown stops retry scheduling, adjusts pending counts, closes active retry attempts, and waits for retry executor termination. Tests cover origin-aware registration and retirement of an active retry.
sequenceDiagram
participant VoteForwarder
participant RetryExecutor
participant Receiver
participant TargetServer
VoteForwarder->>TargetServer: Attempt initial forwarding
TargetServer-->>VoteForwarder: Return eligible pre-write failure
VoteForwarder->>RetryExecutor: Schedule retry
RetryExecutor->>VoteForwarder: Run retry
VoteForwarder->>Receiver: Check active state and current target configuration
VoteForwarder->>TargetServer: Resolve, connect, handshake, and send
Loading
Possibly related PRs
BenCodez/VotifierPlus#194: Changes the same VoteForwarder retirement lifecycle by closing outbound sockets and bounding forwarding attempts.
Merge Risk: Minimal · up to b763d
The change adds bounded in-memory retries for eligible pre-write forwarding failures and cancels them on shutdown. No concrete defect was found in the retry queue limit, retirement handling or non-retry of ambiguous writes. It looks mergeable once the usual test and build checks pass.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "Retry failed vote forwarding in memory" matches the main change. The changeset adds bounded in-memory retries for retryable vote forwarding failures in VoteForwarder, with a 256-item limit …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check
Explanation
The title "Retry failed vote forwarding in memory" matches the main change. The changeset adds bounded in-memory retries for retryable vote forwarding failures in VoteForwarder, with a 256-item limit and retry scheduling. The title is concise and names the primary behavior. It does not mention the retry timing, the handshake changes, or the origin refactor, but those details are not required in a title.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
Recent review details
Context from checks skipped due to timeout: 1
GitHub Check: build
Additional context used
Learnings: 2
Learning: 2026-10-17T19:14:43.945Z
Learnt from: CR
Repo: BenCodez/VotifierPlus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-17T19:14:43.945Z
Learning: Source excerpt:
# Maintainer and AI-agent guide
## Network and protocol invariants
12. Shutdown must terminate listener and connection workers within a bound and prevent callbacks after disable.
Learnt from: CR
Repo: BenCodez/VotifierPlus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-17T19:14:43.945Z
Learning: Source excerpt:
# Maintainer and AI-agent guide
## Test package organization
Put Java test classes and reusable test helpers under `com.bencodez.votifierplus.tests`, using subpackages for related areas. Match the directories below `src/test/java` to the declared package. Keep new and moved tests in this namespace and update imports, resource lookups, reflection references, and build selectors when relocating them.
[warning] 234-234: Regular expression is compiled from a non-literal, possibly user-controlled value. A crafted regex (or input matched against one) can trigger catastrophic backtracking and hang the thread (ReDoS). Use a hardcoded literal pattern, wrap untrusted text with Pattern.quote(...), or validate/length-limit the input and enforce a matching timeout before passing it to Pattern.compile / String.matches / String.replaceAll / String.replaceFirst.
Context: retry.matches(server)
Note: [CWE-1333] Inefficient Regular Expression Complexity.
[warning] 743-743: Avoid user-generated class names for reflection
Context: Class.forName(VoteForwarder.class.getName() + "$Origin")
Note: [CWE-470] Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection').
[info] 282-337: "Detected use of a Java socket that is not encrypted. As a result, the
traffic could be read by an attacker intercepting the network traffic. Use
an SSLSocket created by 'SSLSocketFactory' or 'SSLServerSocketFactory'
instead."
Context: new Socket() { @Override
public void connect(SocketAddress address, int timeout) throws IOException {
int port = ((InetSocketAddress) address).getPort();
connects.add(port);
if (port == unavailablePort) {
throw new ConnectException();
}
}
@Override
public ByteArrayInputStream getInputStream() {
return new ByteArrayInputStream((greeting + "\n").getBytes(StandardCharsets.UTF_8));
}
@Override
public synchronized void close() throws IOException {
super.close();
if (blockWrite) {
retrySocketClosed.countDown();
}
}
@Override
public OutputStream getOutputStream() {
return new OutputStream() {
@Override
public void write(byte[] bytes) throws IOException {
writeCalls++;
if (blockWrite) {
writeStarted.countDown();
try {
if (!retrySocketClosed.await(4, TimeUnit.SECONDS)) {
throw new AssertionError("Retry socket was not closed during retirement");
}
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
throw new AssertionError(ex);
}
throw new IOException("Socket closed");
}
if (failWrite) {
throw new IOException();
}
var payload = new ByteArrayOutputStream();
payload.write(bytes);
payloads.add(payload);
}
@Override
public void write(int value) {
throw new AssertionError("Expected a whole payload");
}
};
}
}
Note: [CWE-319] Cleartext Transmission of Sensitive Information
The comment's capacity-violation claim is not supported. Retry admission and slot release both run under lifecycleLock. Admission also checks the shutdown state before it reads pendingRetries. Before retirement, the count equals the reserved slots and cannot exceed retryCapacity. The drained queue is subtracted exactly once, and a task that runs releases its slot exactly once in runRetry's finally block.
The only remaining divergence is the model's Discard case. A dequeued wrapper that never enters runRetry could leave pendingRetries stale. That can happen only after retirement. The count is private, and admission is already blocked there. No observable capacity, retry, or data consequence follows, so this does not establish a material defect.
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
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.
Summary
Verification
8e861dfdtob763d9ff.Runtime limits
Summary by CodeRabbit