ImageFrame icon indicating copy to clipboard operation
ImageFrame copied to clipboard

Possible memory leak

Open w1th0utme opened this issue 1 year ago • 6 comments

Server version: 1.20.4 ImageFrame version: 1.7.8.2

Craft Scheduler Thread - 8607 - ImageFrame
  at com.loohp.imageframe.objectholders.AnimatedFakeMapManager.lambda$buildAllItemFrameInfo$0(Lorg/bukkit/entity/ItemFrame;Lcom/google/common/collect/ImmutableMap$Builder;Ljava/util/concurrent/CompletableFuture;)V (AnimatedFakeMapManager.java:122)
  at com.loohp.imageframe.objectholders.AnimatedFakeMapManager$$Lambda+0x00007f04f3fd4000.run()V ()
  at com.loohp.imageframe.objectholders.AnimatedFakeMapManager.buildAllItemFrameInfo(Ljava/util/Set;Z)Lcom/google/common/collect/ImmutableMap; (AnimatedFakeMapManager.java:130)
  at com.loohp.imageframe.objectholders.AnimatedFakeMapManager.run()V (AnimatedFakeMapManager.java:155)
  at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftTask.run()V (CraftTask.java:100)
  at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftAsyncTask.run()V (CraftAsyncTask.java:57)
  at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run()V (ServerSchedulerReportingWrapper.java:22)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V (ThreadPoolExecutor.java:1144)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run()V (ThreadPoolExecutor.java:642)
  at java.lang.Thread.runWith(Ljava/lang/Object;Ljava/lang/Runnable;)V (Thread.java:1596)
  at java.lang.Thread.run()V (Thread.java:1583)

image

image

image

w1th0utme avatar Jun 06 '24 22:06 w1th0utme

Which server implementation are you running?

LOOHP avatar Jun 06 '24 22:06 LOOHP

Which server implementation are you running?

I can say pufferfish. It's actually a UniverseSpigot, but it's based entirely on pufferfish and can't exactly break anything in that regard.

w1th0utme avatar Jun 06 '24 23:06 w1th0utme

Do you have any ideas about that?

w1th0utme avatar Jun 09 '24 00:06 w1th0utme

I found a similar thing using v1.7.9.0, this is from a heap dump with 0 players online so there should be 0 CraftPlayer instances image Seems like it comes from pendingKnownMapIds in com.loohp.imageframe.objectholders.AnimatedFakeMapManager, it's holding to Player instances even after they leave.

ChanceSD avatar Aug 07 '24 00:08 ChanceSD

I found a similar thing using v1.7.9.0, this is from a heap dump with 0 players online so there should be 0 CraftPlayer instances image Seems like it comes from pendingKnownMapIds in com.loohp.imageframe.objectholders.AnimatedFakeMapManager, it's holding to Player instances even after they leave.

Under player quit event, remove player object from pendingKnownMapIds map maybe can solve this? https://github.com/LOOHP/ImageFrame/blob/e1fe6dc81ecf50c76562991400549844893b5013/common/src/main/java/com/loohp/imageframe/objectholders/AnimatedFakeMapManager.java#L338

btw, I think it's better to store player uuid as key instead of the entire player object.

Dreeam-qwq avatar Aug 11 '24 19:08 Dreeam-qwq

I found a similar thing using v1.7.9.0, this is from a heap dump with 0 players online so there should be 0 CraftPlayer instances image Seems like it comes from pendingKnownMapIds in com.loohp.imageframe.objectholders.AnimatedFakeMapManager, it's holding to Player instances even after they leave.

Under player quit event, remove player object from pendingKnownMapIds map maybe can solve this?

https://github.com/LOOHP/ImageFrame/blob/e1fe6dc81ecf50c76562991400549844893b5013/common/src/main/java/com/loohp/imageframe/objectholders/AnimatedFakeMapManager.java#L338

btw, I think it's better to store player uuid as key instead of the entire player object.

Yep, that's what I did on my fork, just removed it on quit event, not sure if there are any side effects but so far didn't notice any problem.

ChanceSD avatar Aug 12 '24 00:08 ChanceSD