Skip to content

[BUG] Player is memory leaked if Fire is called after PlayerRemoving #216

@dev-alastair

Description

@dev-alastair

Describe the bug

After the PlayerRemoving event fires for a player, if any calls are made to Fire or another dispatcher, zap adds that Player to player_map again on the server. This is then never cleaned up and persists forever.

Reproduction

event Test = {
    from: Server,
    type: Reliable,
    call: ManyAsync,
    data: (),
}

Playground link

local Players = game:GetService("Players")
local network = require("./network/server")

Players.PlayerRemoving:Connect(function(player)
	task.wait(5)
	network.Test.Fire(player)
	print("Player will remain in player_map forever!")
end)

Expected behavior

Although this event has been fired in error (after player has left), zap should protect against this or issue a warning when this occurs. As it stands, an event firing seconds after the player leaves silently causes a memory leak.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions