-
-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConcurrentModificationException in PacketListenerSet #3234
Comments
Facing the same issue for 1.20.1, with the latest dev build. And almost the same code. Note that I'm intending to listen to every single packet for my use case. ProtocolManager manager = ProtocolLibrary.getProtocolManager();
manager.addPacketListener(new PacketAdapter(this, PacketType.values()) {
@Override
public void onPacketReceiving(PacketEvent event) {
try {
PacketType packetType = event.getPacket().getType();
System.out.println("[PACKET RECIEVED] " + packetType.toString());
} catch(Exception e) {
System.out.println("[PACKET READ FAIL]" + e.toString());
}
}
@Override
public void onPacketSending(PacketEvent event) {
try {
PacketType packetType = event.getPacket().getType();
System.out.println("[PACKET SENT] " + packetType.toString());
} catch(Exception e) {
System.out.println("[PACKET READ FAIL]" + e.toString());
}
}
}); [01:56:51 WARN]: [ProtocolLib] Error filtering reports: java.lang.IllegalArgumentException: Cannot find report name for Plugin %s tried to register listener for unknown packet %s [direction: from %s]
[01:56:51 WARN]: [ProtocolLib] [OutboundPacketListenerSet] Plugin ListenerPlugin tried to register listener for unknown packet CUSTOM_SOUND_EFFECT[PLAY, SERVER, 237, classNames: [net.minecraft.network.protocol.game.PacketPlayOutCustomSoundEffect, net.minecraft.network.protocol.game.ClientboundCustomSoundEffectPacket, PacketPlayOutCustomSoundEffect, ClientboundCustomSoundEffectPacket, CustomSoundEffect, net.minecraft.network.play.server.SPacketCustomSound] (unregistered)] [direction: from SERVER]
[01:56:51 ERROR]: Error occurred while enabling ListenerPlugin v1.0-SNAPSHOT (Is it up to date?)
java.util.ConcurrentModificationException: null
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1605) ~[?:?]
at java.util.HashMap$KeyIterator.next(HashMap.java:1628) ~[?:?]
at com.comphenix.protocol.injector.collection.PacketListenerSet.addListener(PacketListenerSet.java:48) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.PacketFilterManager.addPacketListener(PacketFilterManager.java:313) ~[ProtocolLib.jar:?]
at org.listener.listenerplugin.ListenerPlugin.onEnable(ListenerPlugin.java:27) ~[ListenerPlugin-1.0-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:189) ~[paper-1.20.1.jar:git-Paper-196]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104) ~[paper-1.20.1.jar:git-Paper-196]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugin(CraftServer.java:642) ~[paper-1.20.1.jar:git-Paper-196]
at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugins(CraftServer.java:553) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:635) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:434) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:308) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.20.1.jar:git-Paper-196]
at java.lang.Thread.run(Thread.java:1570) ~[?:?] |
BjornTheProgrammer
added a commit
to BjornTheProgrammer/ProtocolLib
that referenced
this issue
Sep 22, 2024
BjornTheProgrammer
added a commit
to BjornTheProgrammer/ProtocolLib
that referenced
this issue
Sep 22, 2024
Created pull request #3241 which fixes the issue. |
The pull request has been merged, this should be fixed! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Throws a ConcurrentModificationException during listener registration.
The bug is caused by a
.remove()
call within a for-loop (link is anchored to current-latest commit, so no latest build fixes this). This could be fixed with replacing the short for-loop style with an explicit iterator.To Reproduce
Was only trying to create a listener that printed out all sent and received messages, this is the extent of the code:
Expected behaviour
That it registers without throwing, particularly since
PacketType.values()
is so readily available that it seems like the intent is to be usable in this way.Screenshots
N/A
Version Info
dump-2024-09-17_20.23.11.txt
TL;DO:
Additional context
N/A
The text was updated successfully, but these errors were encountered: