[SPIGOT-1301] Memory Leak Part Two Created: 20/Nov/15  Updated: 25/Nov/15  Resolved: 23/Nov/15

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: MarcoCount Assignee: Unassigned
Resolution: Cannot Reproduce Votes: 0
Labels: 1.8, Craftbukkit, spigot
Environment:

Debian 8 64 bit. 36 Gb Ram


Attachments: PNG File Cattura.PNG     PNG File Cattura.PNG     PNG File Cattura2.PNG     PNG File Cattura3.PNG    
Issue Links:
Duplicate
is duplicated by SPIGOT-1211 Memory Leak Closed

 Description   

Hi all.
md_5 asked me to start my server with only 8 Gb of Ram.
Please admins contact me on marcocount@gmail.com for the link of the heapdump.
Thank you very much.
Original discussion:
https://hub.spigotmc.org/jira/browse/SPIGOT-1211



 Comments   
Comment by Keyle Claw [ 25/Nov/15 ]

OK I have to admit that MyPet is the cause of this memory leak.

The documentation of the MetadataStore may not be sufficient when it is that easy to create a huge memory leak like this. I would guess that most of the plugins that use the MetadataStore with non primitive datatypes are not aware that they could cause this.

Comment by MarcoCount [ 25/Nov/15 ]

There are a lot of players in memory (about 450) but online there were about 10, all in the entityMetadata in org.bukkit.craftbukkit.v1_8_R3.metadata.EntityMetadataStore.

UPDATE
MyPet is the cause of memory leaks!

Comment by MarcoCount [ 24/Nov/15 ]

EntitySheep gc paths:
https://hub.spigotmc.org/jira/secure/attachment/10602/Cattura.PNG

EntiyChicken gc paths:
https://hub.spigotmc.org/jira/secure/attachment/10603/Cattura2.PNG

EntityZombie gc paths (without ignoring WeakReferences):
https://hub.spigotmc.org/jira/secure/attachment/10604/Cattura3.PNG

Comment by MarcoCount [ 24/Nov/15 ]

Yes @RoboMWM is right.
In any case I spend time whatching on the first dump.
I found some data really interesting:

The leak is not caused by MyPet but by a metadata map that doesn't let gc to remove a huge number of dead.
Please md_5 look at this https://hub.spigotmc.org/jira/secure/attachment/10601/Cattura.PNG
Thank you very much

P.S: the strange thingis that it is a WeakHashMap

Immediate dominators of 7492 EntitySheep is org.bukkit.craftbukkit.v1_8_R3.util.UnsafeList

Comment by RoboMWM [ 24/Nov/15 ]

md5 never claimed it was due to MyPet, he just provided a guess...

Comment by coller [ 24/Nov/15 ]

i just find i can kill creature after i remove it.
and creature will drop some stuff on the ground
can “remove();” Complete “remove entity”?
i don't konw if there is something wrong here...

    @EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled=false)
    public void onSpawnerSpawn(SpawnerSpawnEvent event){
        Creature e = (Creature) event.getEntity();
        e.remove();
        e.damage(1000);
Comment by Keyle Claw [ 24/Nov/15 ]

IDK but MyPet doesn't use the normal entities so it can't cause theses numbers.

Comment by MarcoCount [ 24/Nov/15 ]

@Keyle: Which config node can spawn so much entities?
In any case most of them aren't living...

Comment by Keyle Claw [ 24/Nov/15 ]

@md_5: Just reading you two comments says everything... You have no idea about the plugin but at least you can trashtalk it. The amount of entities is NOT a result of MyPet so it must be a config (or MAYBE a server) problem. So next time please do your research...

Comment by MarcoCount [ 23/Nov/15 ]

Ok.
thank you very much!
I will update you on the progress!

Comment by md_5 [ 23/Nov/15 ]

I cannot tell, but the MyPet plugin looks suspect, I'd start by removing it.
Deleting bukkit.yml / spigot.yml to reset them to defaults wouldn't be a bad idea either.

Comment by MarcoCount [ 23/Nov/15 ]

What does spawn so much entities?
MyPet doesn't remove them after players send them away?

Comment by md_5 [ 23/Nov/15 ]

I see a poorly written plugin called MyPet, and also the fact that you have over 30,000 entities on your server (7000 chickens (1.3gb), 7000 sheep (1gb), 6000 pigs (900mb), 5000 rabbits (900mb), 4600 cows (600mb), 1500 zombies (1.4gb), 1000 skeletons (500mb)), as well as a bunch of stuff I can't be bothered to add up.

The fact that nearly 7gb of ram is going to just these entities (because you have 10x as many as any normal server!) suggests that your issues are to do with administration and/or plugin choice (mypet) rather than a bug.

Comment by MarcoCount [ 22/Nov/15 ]

http://s30.postimg.org/ba9xvv681/IMG_20151122_010950.jpg

Comment by MarcoCount [ 22/Nov/15 ]

The stranger thing is that there is a hash map in entities of entity metadata store that is about 1,2 GB.
What is it?!?
Pathfinder occupy 120 mb for some entities too....

Comment by MarcoCount [ 21/Nov/15 ]

Any news?
In the next few hours I will post the new heapdump with the latest spigot build.

Comment by RoboMWM [ 20/Nov/15 ]

You could potentially get more help if you just link your heap dump, or at least provide a list of plugins, logs, etc.

Comment by SpigotMC [ 20/Nov/15 ]

Your build is not the latest and therefore may be the reason you are having this issue. Spigot is 3 version(s) behind. CraftBukkit is 7 version(s) behind. This message was automatically generated and is not guaranteed to be a solution to your issue.

Generated at Tue Apr 22 06:07:37 UTC 2025 using Jira 10.3.5#10030005-sha1:190c783f2bd6c69cd5accdb70f97e48812a78d14.