satoshinm / WebSandboxMC

Bukkit plugin providing a web-based interface with an interactive WebGL 3D preview or glimpse of your server 🕷⏳📦 ⛺
https://www.spigotmc.org/resources/websandboxmc.39415/
MIT License
19 stars 5 forks source link

Disconnecting web clients does not always remove their web entities #38

Closed satoshinm closed 7 years ago

satoshinm commented 7 years ago

https://www.spigotmc.org/threads/websandboxmc.232807/#post-2362946

It seems not to eliminate inactive webguests.

I think I've seen this too, maybe it is related to the Entity map:

public class WebPlayerBridge {

    private final WebSocketServerThread webSocketServerThread;

    private int lastPlayerID;
    public Map<ChannelId, String> channelId2name;
    public Map<ChannelId, Entity> channelId2Entity;

Can I safely store Entity in a map, long-term, or does it need to be looked up by entity ID or something? Either way, something appears broken in tracking the entities. Another test is to sheer an web player entity's sheep, or kill it, in both cases the web player should be notified, but they aren't always.

satoshinm commented 7 years ago

Testing as follows: webguest1 signs in, webguest2 signs in (sees 1), then logs out (1 sees 2 disappear). However once another user, webguest3 signs back in, he sees both! It as if the "delete entity" message is only sent to logged-in users, but there is missing cleanup on the backend.

satoshinm commented 7 years ago

Web entities persisting was a real issue, but a different issue. Bukkit entities still persist unexpectedly:

screen shot 2017-04-23 at 12 56 29 pm
satoshinm commented 7 years ago

The second problem is upon closing the server. Adding a cleanup step to delete these entities since they won;t get cleaned up during normal client disconnect. This fixes /stop, however, note that it won't fix abruptly terminating the server with ^C not cleaning up the entities, because the plugin has no chance to do so.