Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

Conversation

Copy link
Contributor

Copilot AI commented Nov 1, 2025

The snapshot() method released the read lock before deep-copying the tag, allowing concurrent writes to mutate FastCompoundBinaryTag during traversal—causing potential corruption or exceptions.

Changes

  • Introduced snapshotTag() template method in PersistentPlayerDataContainerViewImpl that subclasses override to control locking scope
  • Extended lock coverage in CommonCloudPlayerImpl.persistentDataView to hold read lock for entire snapshot operation (tag retrieval + deep copy)

Example

// Before: lock released between toTagCompound() and deepCopy()
override fun snapshot(): PersistentPlayerDataContainerViewImpl {
    val tag = deepCopy(toTagCompound())  // toTagCompound() acquires+releases lock
    // deepCopy() executes without lock protection ← race window
}

// After: entire operation under lock
override fun snapshotTag() = ppdcReentrantLock.read { 
    super.snapshotTag()  // both toTagCompound() and deepCopy() now protected
}

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copy link
Contributor Author

Copilot AI commented Nov 1, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • repo.slne.dev
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xmx4G -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.14.3-bin/cv11ve7ro1n3o1j4so8xd9n66/gradle-8.14.3/lib/gradle-daemon-main-8.14.3.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.14.3-bin/cv11ve7ro1n3o1j4so8xd9n66/gradle-8.14.3/lib/agents/gradle-instrumentation-agent-8.14.3.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.14.3 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Update handling of persistent player data tracking Fix race condition in PersistentPlayerDataContainerView.snapshot() Nov 1, 2025
Copilot AI requested a review from twisti-dev November 1, 2025 13:19
- Replaced `tag.fast()` with `snapshotTag().fast()` in snapshot methods of player data containers.
@twisti-dev twisti-dev marked this pull request as ready for review November 1, 2025 13:58
@twisti-dev twisti-dev merged commit 28f5fb2 into feat/ppdc-view Nov 1, 2025
1 check passed
@twisti-dev twisti-dev deleted the copilot/sub-pr-113-another-one branch November 1, 2025 13:59
@github-project-automation github-project-automation bot moved this from Backlog to Done in surf-cloud Nov 1, 2025
@github-actions
Copy link

github-actions bot commented Nov 1, 2025

Qodana for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at [email protected]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants