8000 fix: player data shutdown loss [EcoHub-312] by Exanthiax · Pull Request #676 · Auxilor/eco · GitHub
[go: up one dir, main page]

Skip to content

fix: player data shutdown loss [EcoHub-312] - #676

Merged
Exanthiax merged 4 commits into
masterfrom
fix/data_shutdown_persistence
Oct 29, 2026
Merged

Exanthiax merged 4 commits into
masterfrom
fix/data_shutdown_persistence

Conversation

@Exanthiax
Copy link
Copy Markdown
Member

No description provided.

@coderabbitai
coderabbitai Bot commented Oct 28, 2026 •
Copy link
Copy Markdown

Review in Change Stack →

Walkthrough

Persistent data writes and profile-serialisation reads now use single-thread executors selected by UUID and key. Shutdown waits for all executors before saving. ProfileWriter can expose pending values and flush queued writes while retaining replacements made during a flush. Profile reads check pending values before stored data and defaults. ProfileHandler.save closes the writer, saves migration data when applicable, and stops Redis listening before shutting down handlers. ServerLocking.lockReason is now volatile.

Priority: Normal

Merge Risk: Moderate · up to dfd7a

Player data written during plugin shutdown could be lost if a write reaches a handler after its executor has stopped. A value whose write fails before submission is also logged and dropped rather than retried. Both cases are narrow, but the shutdown ordering should be settled before merging.

Security architecture risk: Low · up to dfd7a

The change improves player-data persistence without an established new unauthorized-access path. Exceptional shutdown and concurrent late-write behavior still have limited assurance.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Persistence-ordering failures can affect profiles served by the affected handler. Redis-backed writes can also affect cache visibility on servers sharing its configured synchronization channel; the deployment's server and data-store scope is not established.

Trust Boundaries and Controls

  • observed — Redis messages identify a UUID and registered namespaced key; the receiver validates those identifiers and respects a pending local write before invalidation. The message carries no replacement value: the receiver reads it from Redis. These identity checks do not themselves establish publisher authorization.

Resilience and Maintainability Implications

  • observed — A handler shutdown exception exits before the final sync.stop call, leaving the sender marker uncleared despite listener shutdown. This is incomplete cleanup, but the inspected marker only controls announcements accompanying normal Redis writes; an additional security consequence was not established.

Hardening Proposals

  • proposed — Make final synchronization cleanup independent of individual handler shutdown failures, while preserving outgoing announcements until submitted writes have drained and retaining interruption information.
Pre-merge checks: Passed 2 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 2 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 9 functions across 9 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: 7e0572d9-0286-4c55-bbce-f83dc4c8f135
Commits

Reviewing files that changed from the base of the PR and between 10acfac and 41a74f5.

Files selected for processing: 8
  • eco-api/src/main/java/com/willfp/eco/core/data/handlers/PersistentDataHandler.java
  • eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/ServerLocking.kt
  • eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/profiles/ProfileHandler.kt
  • eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/profiles/ProfileWriter.kt
  • eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/profiles/impl/EcoProfile.kt
  • eco-core/core-plugin/src/test/kotlin/com/willfp/eco/internal/spigot/data/handlers/PersistentDataHandlerShutdownTests.kt
  • eco-core/core-plugin/src/test/kotlin/com/willfp/eco/internal/spigot/data/profiles/ProfileSyncHookTests.kt
  • eco-core/core-plugin/src/test/kotlin/com/willfp/eco/internal/spigot/data/profiles/ProfileWriterTests.kt

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@coderabbitai coderabbitai Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 381e5884-bd31-4af1-a834-ea96daffe256
Commits

Reviewing files that changed from the base of the PR and between 41a74f5 and 5309465.

Files selected for processing: 2
  • eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/profiles/ProfileHandler.kt
  • eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/profiles/ProfileWriter.kt

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@coderabbitai coderabbitai Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Major · Close the writer before the final drain. · ProfileWriter.kt:72-85

eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/profiles/ProfileWriter.kt:72-85
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Close the writer before the final drain.

ProfileWriter.write() can replace a queued value while flush() is iterating valuesToWrite. The iterator can pass the old value, and the conditional removal then leaves the replacement queued. ProfileHandler.save() performs one flush before it shuts down the handlers. A replacement written during shutdown can therefore remain uncommitted and be lost.

Stop new profile writes before the final drain, then shut down the handlers. A second unsynchronised flush() is not sufficient because another write can arrive during that flush. The correction belongs at the shutdown boundary, with ProfileWriter providing the coordination if needed.


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 79f8a5b3-d958-4aa3-9c81-6af4ad12ec90
Commits

Reviewing files that changed from the base of the PR and between 5309465 and 12db4b9.

Files selected for processing: 2
  • eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/profiles/ProfileHandler.kt
  • eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/profiles/RedisProfileSync.kt

Limit details: You’ve used all 10 included reviews currently available.

@Exanthiax
Copy link
8000 Copy Markdown
Member Author

@coderabbitai resume

@coderabbitai
coderabbitai Bot commented Oct 28, 2026 •
Copy link
Copy Markdown
✅ Action performed

Reviews resumed. No new commits to review.

@coderabbitai coderabbitai Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 25b72fe9-804d-4669-96b8-b434f265ed19
Commits

Reviewing files that changed from the base of the PR and between 12db4b9 and dfd7a6c.

Files selected for processing: 3
  • eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/profiles/ProfileHandler.kt
  • eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/profiles/ProfileWriter.kt
  • eco-core/core-plugin/src/test/kotlin/com/willfp/eco/internal/spigot/data/profiles/ProfileWriterTests.kt

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@Exanthiax
Exanthiax merged commit a62b13c into master Oct 29, 2026
4 checks passed
@Exanthiax
Exanthiax deleted the fix/data_shutdown_persistence branch October 29, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0