"java.lang.OutOfMemoryError: Java heap space" when trying to undo actions that overlap their source region
BrainStone opened this issue ยท 4 comments
Server Implementation
Paper
Server Version
1.21
Describe the bug
When undoing an action that overlapped the source region (like a //move 1
) and then trying to undo results in this OOM error. The server was chilling at <4GB of RAM used before the undo and then shot up to the max of 8GB it has.
Looks like some kind of recursion issue.
To Reproduce
- Make a selection of complex geometry (in my case it was redstone stuff, not sure if that's relevant)
- Perform an action that results in the target area overlapping with the source area (like
//move 1
or copy pasting while only walking a few blocks) - Observe the error
Expected behaviour
Undoing shouldn't just suck up all available heap space and silently crash.
Screenshots / Videos
No response
Error log (if applicable)
https://gist.github.com/BrainStone/e183700941c2da56acc117086163f140
Fawe Debugpaste
https://athion.net/ISPaster/paste/view/63cec786d39c4d60b8340292d5a8ddec
Fawe Version
2.11.3-SNAPSHOT-922;b4635e8
Checklist
- I have included a Fawe debugpaste.
- I am using the newest build from https://ci.athion.net/job/FastAsyncWorldEdit/ and the issue still persists.
Anything else?
The selections were rather small (<1000 blocks), nothing huge here. Also sometimes it works, sometimes it doesn't. I'm not 100% sure what exactly causes the issue, but it only ever happened with overlapping selections.
I cannot reproduce the problem in build 922. There where a few builds with a bug that caused this bug (the fix is #2919). Did you by any chance undo a change that was done with a broken build?
Oh that's a possibility! I did in fact update and tried to repeat an undo that previously failed.
Looking at the linked issue this would explain the issue if the previous version just wrote garbage history data. I'll retest to verify.
I can reproduce this on the latest FastAsyncWorldEdit version (2.11.2) on an empty new Paper server. This seems to always work to reproduce it:
- Find a trial chamber:
/locate structure minecraft:trial_chamber
- Teleport to it
- Replace some blocks:
//replacenear 10 air
- Try to undo it:
//undo
Error log:
[03:00:02 INFO]: Steve issued server command: //undo
[03:00:06 WARN]: Can't keep up! Is the server overloaded? Running 2919ms or 58 ticks behind
[03:00:06 WARN]: Exception in thread "FAWE undo0" java.lang.OutOfMemoryError: Java heap space
[03:00:06 WARN]: at FastAsyncWorldEdit-Bukkit-2.11.2.jar//com.sk89q.jnbt.NBTInputStream.readTagPayload(NBTInputStream.java:635)
[03:00:06 WARN]: at FastAsyncWorldEdit-Bukkit-2.11.2.jar//com.sk89q.jnbt.NBTInputStream.readTag(NBTInputStream.java:101)
[03:00:06 WARN]: at FastAsyncWorldEdit-Bukkit-2.11.2.jar//com.fastasyncworldedit.core.history.changeset.FaweStreamChangeSet$CompoundTagPopulator.populate(FaweStreamChangeSet.java:790)
[03:00:06 WARN]: at FastAsyncWorldEdit-Bukkit-2.11.2.jar//com.fastasyncworldedit.core.history.change.ChangePopulator.updateOrCreate(ChangePopulator.java:56)
[03:00:06 WARN]: at FastAsyncWorldEdit-Bukkit-2.11.2.jar//com.fastasyncworldedit.core.history.changeset.FaweStreamChangeSet.fillArray(FaweStreamChangeSet.java:763)
[03:00:06 WARN]: at FastAsyncWorldEdit-Bukkit-2.11.2.jar//com.fastasyncworldedit.core.history.changeset.FaweStreamChangeSet.lambda$coordinatedChanges$0(FaweStreamChangeSet.java:744)
[03:00:06 WARN]: at FastAsyncWorldEdit-Bukkit-2.11.2.jar//com.fastasyncworldedit.core.history.changeset.FaweStreamChangeSet$$Lambda/0x00007fddd5820d48.accept(Unknown Source)
[03:00:06 WARN]: at FastAsyncWorldEdit-Bukkit-2.11.2.jar//com.fastasyncworldedit.core.history.changeset.ChangeExchangeCoordinator.lambda$take$0(ChangeExchangeCoordinator.java:32)
[03:00:06 WARN]: at FastAsyncWorldEdit-Bukkit-2.11.2.jar//com.fastasyncworldedit.core.history.changeset.ChangeExchangeCoordinator$$Lambda/0x00007fddd58213b0.run(Unknown Source)
[03:00:06 WARN]: at java.base/java.lang.Thread.runWith(Unknown Source)
[03:00:06 WARN]: at java.base/java.lang.VirtualThread.run(Unknown Source)
[03:00:06 WARN]: at java.base/java.lang.VirtualThread$VThreadContinuation$1.run(Unknown Source)
[03:00:06 WARN]: at java.base/jdk.internal.vm.Continuation.enter0(Unknown Source)
[03:00:06 WARN]: at java.base/jdk.internal.vm.Continuation.enter(Unknown Source)
[03:00:06 WARN]: at java.base/jdk.internal.vm.Continuation.enterSpecial(Native Method)
Afterwards, FastAsyncWorldEdit seems to be broken entirely until server restart.
I can confirm this is fixed in the latest snapshot build. I see that the fix you linked was committed one day after the release of the current latest version in GitHub releases, 2.11.2. Since then, numerous people have complained about this bug on Discord and in reviews on Spigot, but there has not been a release since. Can you please either make a release containing the fix, or update the README to indicate that people should use snapshot builds instead of releases? Hopefully this can save time and effort for anyone else who, like me, grabs the latest GitHub release and finds that it doesn't work properly.
EDIT: Another major bug that can cause data loss (#2948) exists in snapshots since 901 (Sep 14th), so even the snapshots are not good to use.