MineColonies

MineColonies

59M Downloads

[Performance] Memory Leak of ServerPlayers

pietro-lopes opened this issue ยท 1 comments

commented

Is there an existing issue for this?

  • I have searched the existing issues.

Are you using the latest MineColonies Version?

  • I am running the latest beta/release version of MineColonies for my Minecraft version.
    I am also running the latest versions of other mods that are part of my problem.

Did you check on the Wiki? or ask on Discord?

  • I checked the MineColonies Wiki and made sure my issue is not covered there. Or I was sent from discord to open an issue here.

What were you playing at the time? Were you able to reproduce it in both settings?

  • Single Player
  • Multi Player

Minecraft Version

1.21

MineColonies Version

1.1.806

Structurize Version

1.0.755

Related Mods and their Versions

Neoforge 21.1.81

Current Behavior

Those are leaking players as we checked our heapdump.
ServerPlayers removed from Level were still there (with removalReason UNLOADED_WTIH_PLAYER).

private final List<Player> visitingPlayers = new ArrayList<>();

private final List<AttackingPlayer> attackingPlayers = new ArrayList<>();

image

Expected Behavior

No leak

Reproduction Steps

This was checked from a heap dump of our dedicated servers

Logs

NA

Anything else?

No response

Footer


Viewers

  • Add a thumbs-up to the bug report if you are also affected. This helps the bug report become more visible to the team and doesn't clutter the comments.
  • Add a comment if you have any insights or background information that isn't already part of the conversation.
commented
    /**
     * Updates the pvping playeres.
     */
    public void updateAttackingPlayers()
    {
        final List<Player> visitors = new ArrayList<>(visitingPlayers);

        //Clean up visiting player.
        for (final Player player : visitors)
        {
            if (!packageManager.getCloseSubscribers().contains(player))
            {
                visitingPlayers.remove(player);
                attackingPlayers.remove(new AttackingPlayer(player));
            }
        }

We actually clean those out regularily. It just might take a minute after the player logs out in a colony.
So this is also fine.