rocketman10404 / tabbychat

TabbyChat chat mod for Minecraft
20 stars 29 forks source link

ArrayIndexOutOfBoundsException upon connecting to a server #1

Closed 14mRh4X0r closed 11 years ago

14mRh4X0r commented 11 years ago

On 1.7.08, especially when having a rather high load, this tends to happen upon connecting to the server. I've only just updated to 1.8.01, and haven't really played on it yet, but I figured this might be useful to report anyway, since I haven't seen a clear description of a bug like this being fixed in the changelogs.

The crash report:

---- Minecraft Crash Report ----
// This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]

Time: 11-6-13 16:05
Description: Ticking screen

java.lang.ArrayIndexOutOfBoundsException: 207
    at java.util.concurrent.CopyOnWriteArrayList.get(CopyOnWriteArrayList.java:368)
    at java.util.concurrent.CopyOnWriteArrayList.remove(CopyOnWriteArrayList.java:475)
    at acs.tabbychat.core.ChatChannel.trimLog(ChatChannel.java:100)
    at acs.tabbychat.core.TabbyChat.addToChannel(TabbyChat.java:150)
    at acs.tabbychat.core.TabbyChat.addToChannel(TabbyChat.java:130)
    at acs.tabbychat.core.TabbyChat.processChat(TabbyChat.java:434)
    at acs.tabbychat.core.GuiNewChatTC.func_96129_a(GuiNewChatTC.java:346)
    at acs.tabbychat.core.GuiNewChatTC.func_73763_a(GuiNewChatTC.java:486)
    at acs.tabbychat.core.GuiNewChatTC.func_73765_a(GuiNewChatTC.java:482)
    at net.minecraft.client.multiplayer.NetClientHandler.func_72481_a(NetClientHandler.java:855)
    at net.minecraft.network.packet.Packet3Chat.func_73279_a(SourceFile:44)
    at net.minecraft.network.TcpConnection.func_74428_b(TcpConnection.java:461)
    at net.minecraft.client.multiplayer.NetClientHandler.func_72551_d(NetClientHandler.java:266)
    at net.minecraft.client.multiplayer.GuiConnecting.func_73876_c(GuiConnecting.java:51)
    at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1526)
    at net.minecraft.client.MinecraftAppletImpl.func_71407_l(MinecraftAppletImpl.java:55)
    at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:835)
    at net.minecraft.client.Minecraft.run(Minecraft.java:760)
    at java.lang.Thread.run(Thread.java:679)

A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
    at java.util.concurrent.CopyOnWriteArrayList.get(CopyOnWriteArrayList.java:368)
    at java.util.concurrent.CopyOnWriteArrayList.remove(CopyOnWriteArrayList.java:475)
    at acs.tabbychat.core.ChatChannel.trimLog(ChatChannel.java:100)
    at acs.tabbychat.core.TabbyChat.addToChannel(TabbyChat.java:150)
    at acs.tabbychat.core.TabbyChat.addToChannel(TabbyChat.java:130)
    at acs.tabbychat.core.TabbyChat.processChat(TabbyChat.java:434)
    at acs.tabbychat.core.GuiNewChatTC.func_96129_a(GuiNewChatTC.java:346)
    at acs.tabbychat.core.GuiNewChatTC.func_73763_a(GuiNewChatTC.java:486)
    at acs.tabbychat.core.GuiNewChatTC.func_73765_a(GuiNewChatTC.java:482)
    at net.minecraft.client.multiplayer.NetClientHandler.func_72481_a(NetClientHandler.java:855)
    at net.minecraft.network.packet.Packet3Chat.func_73279_a(SourceFile:44)
    at net.minecraft.network.TcpConnection.func_74428_b(TcpConnection.java:461)
    at net.minecraft.client.multiplayer.NetClientHandler.func_72551_d(NetClientHandler.java:266)
    at net.minecraft.client.multiplayer.GuiConnecting.func_73876_c(GuiConnecting.java:51)

-- Affected screen --
Details:
    Screen name: ~~ERROR~~ NullPointerException: null
Stacktrace:
    at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1526)

-- Affected level --
Details:
    Level name: MpServer
    All players: 1 total; [EntityClientPlayerMP['14mRh4X0r'/304361, l='MpServer', x=-194,47, y=10,62, z=412,66]]
    Chunk stats: MultiplayerChunkCache: 0
    Level seed: 0
    Level generator: ID 00 - default, ver 1. Features enabled: false
    Level generator options: 
    Level spawn location: World: (-127,64,358), Chunk: (at 1,4,6 in -8,22; contains blocks -128,0,352 to -113,255,367), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
    Level time: 224571946 game time, 280261 day time
    Level dimension: 0
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false
    Forced entities: 1 total; [EntityClientPlayerMP['14mRh4X0r'/304361, l='MpServer', x=-194,47, y=10,62, z=412,66]]
    Retry entities: 0 total; []
Stacktrace:
    at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:441)
    at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:2414)
    at net.minecraft.client.Minecraft.run(Minecraft.java:776)
    at java.lang.Thread.run(Thread.java:679)

-- System Details --
Details:
    Minecraft Version: 1.5.2
    Operating System: Linux (i386) version 3.8.0-25-generic
    Java Version: 1.6.0_27, Sun Microsystems Inc.
    Java VM Version: OpenJDK Server VM (mixed mode), Sun Microsystems Inc.
    Memory: 620709872 bytes (591 MB) / 704315392 bytes (671 MB) up to 909705216 bytes (867 MB)
    JVM Flags: 0 total; 
    AABB Pool Size: 1 (56 bytes; 0 MB) allocated, 1 (56 bytes; 0 MB) used
    Suspicious classes: FML and Forge are installed
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP v7.51 FML v5.2.11.707 Minecraft Forge 7.8.0.707 Optifine OptiFine_1.5.2_HD_U_D3 5 mods loaded, 5 mods active
    mcp{7.44} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
    FML{5.2.11.707} [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
    Forge{7.8.0.707} [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
    mod_TabbyChat{1.7.08} [mod_TabbyChat] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
    inventorytweaks{1.53} [Inventory Tweaks] (InventoryTweaks-1.53.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
    LWJGL: 2.4.2
    OpenGL: NVS 5100M/PCIe/SSE2 GL version 3.3.0 NVIDIA 304.88, NVIDIA Corporation
    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Texture Pack: [1.5] R3D CRAFT Default Realism 128x128 (75%).zip
    Profiler Position: N/A (disabled)
    Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

PS: Zombe's modpack 7.2 and GLSL Shaders mod 1.46 are also installed.

rocketman10404 commented 11 years ago

Thanks for the report. You're right, there's not really a clear indication of this being fixed, although I suspect it is in fact fixed in 1.8-on. I haven't given a clear indication because I'm not entirely sure what's causing this - I believe it essentially results from multiple threads attempting to trim the chatLog list at the same time, and also the fact that the trimLog() method attempts to remove the last 10 items at a time. However, I had expected (at the time) that using a CopyOnWriteArrayList would correct this, but I suppose there's still a chance of thread conflict in between the method checking the size and removing the elements.

From 1.8 on, the ChatChannel's chatLog (as well as some other lists) are back to regular ArrayList, protected from potential thread conflicts using ReentrantReadWriteLocks. Additionally, instead of attempting to remove the last 10 elements at once (whenever the log is larger than max size + 5), it now only removes the last element whenever the list exceeds max size. As I understand it, the cost of removing the last element is quite minimal, so calling this more often shouldn't have a noticeable impact on performance.

Although like I said, I can't track down the previous cause with absolute certainty, so I'm not going to close this in case related issues appear in the newer versions. I'll mark it outdated for now, and change it should this happen.

rocketman10404 commented 11 years ago

I believe sufficient time has passed since 1.8.00 with no more occurrences of this or other very similar issues, so I'm marking this as closed.