1
0
mirror of https://github.com/GeyserMC/Geyser.git synced 2026-01-04 15:31:36 +00:00

Resolve some inventory deadlocks due to re-introduction of limit to force-reopening attempts

closes https://github.com/GeyserMC/Geyser/issues/5493, closes https://github.com/GeyserMC/Geyser/issues/5483
This commit is contained in:
onebeastchris
2025-04-19 11:14:38 +02:00
parent efd4dccb60
commit ff44698661

View File

@@ -62,7 +62,7 @@ public class BedrockContainerCloseTranslator extends PacketTranslator<ContainerC
// If virtual inventories are opened too quickly, they can be occasionally rejected
// We just try and queue a new one.
// Before making another attempt to re-open, let's make sure we actually need this inventory open.
if (holder.containerOpenAttempts() < 5) {
if (holder.containerOpenAttempts() < 7) {
holder.incrementContainerOpenAttempts();
holder.pending(true);
@@ -72,11 +72,14 @@ public class BedrockContainerCloseTranslator extends PacketTranslator<ContainerC
latencyPacket.setTimestamp(MAGIC_VIRTUAL_INVENTORY_HACK);
session.sendUpstreamPacket(latencyPacket);
GeyserImpl.getInstance().getLogger().debug(session, "Unable to open a virtual inventory, sent another latency packet!");
}, 100, TimeUnit.MILLISECONDS);
}, 150, TimeUnit.MILLISECONDS);
return;
} else {
GeyserImpl.getInstance().getLogger().debug(session, "Exceeded 5 attempts to open a virtual inventory!");
GeyserImpl.getInstance().getLogger().warning(session.bedrockUsername() + " exceeded 7 attempts to open a virtual inventory!");
GeyserImpl.getInstance().getLogger().debug(session, packet + " " + holder.inventory().getClass().getSimpleName());
// Prevent inventory deadlocks by letting the code below close the inventory
bedrockId = (byte) holder.bedrockId();
}
}
}