Map data do not flush to disk on regular autosave #372
Labels
No labels
documentation
good first issue
help wanted
resolution: duplicate
resolution: invalid
resolution: won't fix
status: needs triage
type: bug
type: feature
type: performance
type: question
version: 1.19.4
version: 1.20
version: 1.20.1
version: 1.20.2
version: 1.20.4
version: 1.20.6
version: 1.21.11
version: 1.21.4
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Minecraft/Folia#372
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Expected behavior
map data do not flush to disk with autosave
Observed/Actual behavior
Playerdata and chunk data are saved properly to disk with autosave, but map data only save to disk on proper shutdown. Map data can be saved with autosave on Paper. If the folia server crashes, all the map data will be lost.
Steps/models to reproduce
It can be reproduce everytime as server crash or unexpected power off
Plugin and Datapack List
None
Folia version
Folia version 1.21.4-DEV-dev/hard-fork@cd49d65 (1970-01-01T00:00:00Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
Other
No response
This bug is incredibly frustrating on servers that utilize map-based artwork. I'm really hoping that it can be addressed or some workaround can be suggested.
https://github.com/PaperMC/Folia/blob/ver/1.21.8/folia-server/minecraft-patches/features/0001-Region-Threading-Base.patch#L8697-L8698
Maybe because this change causes the auto save to no longer work
Found that running the following caused maps to save. Tried to be as unobtrusive to the overall logic as possible, hence why I'm targeting the
DimensionDataStorageinstead of theServerLevelas a whole.I am quite new to working with Folia so this may have unforseen implications regarding multithreading. It will probably be safer to run them inside the
.globalRegionScheduler()1.20 and below
Kotlin
Java
1.21 and above
Kotlin
Java
Likely to be caused by the mentioned patch file, although the original reason for disabling incremental saving in this circumstance seems to have been lost to time as the file has been renamed numerous times.
My temporary solution is to revert the line change mentioned above and add the following to the top of
saveIncrementally()Similarly, only save
DimensionDataStorageto avoid some unexpected problemsAlso, if you get
ConcurrentModificationException, you can add sync lock incollectDirtyTagsToSave()when loopingthis.cacheIt has been running on my server for a few weeks, and the map data is auto saved normally. I haven't encountered any problems yet, but as mentioned above this is just my temporary solution