-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak when using Bukkit#unloadWorld with save=false #9199
Comments
We observed that this issue only happened after updating to 1.19.* |
1.19.3 isn’t latest, is this the same on .4 |
I am having trouble replicating this. @EventHandler
public void on(final PlayerDropItemEvent event) {
event.setCancelled(true);
if (test == null) {
test = Bukkit.createWorld(WorldCreator.name("test").keepSpawnLoaded(TriState.TRUE));
event.getPlayer().sendMessage(Component.text("Loaded custom world `test`"));
event.getPlayer().teleport(test.getSpawnLocation());
} else {
event.getPlayer().teleport(Bukkit.getWorld(NamespacedKey.minecraft("overworld")).getSpawnLocation());
Bukkit.unloadWorld(test, false);
event.getPlayer().sendMessage(Component.text("Unloaded custom world `test`"));
}
} was used to load and unload the world named "test" numerous times, while jmap -dump:live,file=./server.hprof "$(jcmd | grep 'craftbukkit.Main' | cut -d' ' -f1)" was used to create the heap dump. Notably this command only collects live objects, e.g. those that are still referenced. I might be missing something tho, so this issue needs further triage. Beyond that, spigot references for this issue are rather useless, paper rewrites pretty much the entire system there 😅 |
Hey, Best regards |
Im sorry to dig up this thread, but could you maybe do some follow up? I have similar issue, but updating FAWE doesnt seem to help :c |
@jan can you provide more information about the plugins you were using with fawe on IntellectualSites/FastAsyncWorldEdit#2278 ? That might help as well. |
@OneLiteFeather wrong @jan. |
My bad, it doesn't really differenciate between on the phone. |
Timings or Profile link
You don't see any info abouit that leak in any timings.
Description of issue
When unloading worlds using Bukkit#unloadWorld with save=false they get removed from CraftServer#worlds but they still retain in the memory (especially ChunkTaskSchedulers):
![Bildschirmfoto 2023-05-09 um 13 05 15](https://private-user-images.githubusercontent.com/20094418/237078197-fc3c37fc-cc75-478b-8616-adc0a3e99f3d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA2NDczNTAsIm5iZiI6MTcyMDY0NzA1MCwicGF0aCI6Ii8yMDA5NDQxOC8yMzcwNzgxOTctZmMzYzM3ZmMtY2M3NS00NzhiLTg2MTYtYWRjMGEzZTk5ZjNkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzEwVDIxMzA1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWZmMGYwNzBlZDNlMzM3YzYzYTViNTZiYWUxYThmZWM3NGZjZWQ4ZGQyN2Y0NTIxNDNiYmNiNjFmODdmZjY4YTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.7c0Ccw7vP1yBKi7rcO-V0RHosYgk3p62oJJmZckCgcc)
In this screenshot you see there are officially only 6 worlds loaded:
![Bildschirmfoto 2023-05-09 um 13 06 00](https://private-user-images.githubusercontent.com/20094418/237078339-b2211949-3aec-4324-b33e-a387d47fd851.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA2NDczNTAsIm5iZiI6MTcyMDY0NzA1MCwicGF0aCI6Ii8yMDA5NDQxOC8yMzcwNzgzMzktYjIyMTE5NDktM2FlYy00MzI0LWIzM2UtYTM4N2Q0N2ZkODUxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzEwVDIxMzA1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVmYmE5NzQwYWNlZjQ0ZWY2ZjAxNDE0OWEzZGY4ZmNhOTYyODlhOGU5ODEyODQ0ODZhYzkzNDBhYzg5NmU5MGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Mevmn1FyQZrNJgquR3RE3To0etQCptR6SE22n9ID3EI)
This is a massive issue, as you don't know this through timings but only through testing.
Also one guy in the Spigot forum had the same issue:
https://www.spigotmc.org/threads/how-to-fix-memory-leak-unload-world.588677/
Plugin and Datapack List
Doesn't matter
Server config files
Doesn't matter
Paper version
Other
No response
The text was updated successfully, but these errors were encountered: