Random NPE in Sound Manager
LemADEC opened this issue ยท 14 comments
Mod Version: DynamicSurroundings-1.7.10-1.0.6.2
Forge Version: 10.13.4.1614
Link to crash log (if applicable): https://gist.github.com/LemADEC/a5804936505d9b135ce4d862dd81f724
Description:
Since we've updated from 1.0.6.1 to 1.0.6.2, we're observing random NPE client crashes like this one
java.lang.NullPointerException: Unexpected error
at net.minecraft.client.audio.SoundManager.func_148606_a(SoundManager.java:389)
at net.minecraft.client.audio.SoundManager.func_148605_d(SoundManager.java:204)
at net.minecraft.client.audio.SoundHandler.func_73660_a(SourceFile:179)
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:2013)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898)
at net.minecraft.client.main.Main.main(SourceFile:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
No other mods were changed recently on client side, so I suppose it's coming from here.
The differences between 1.0.6.1 and 1.0.6.2 are pretty minor (couple of NPE fixes and OGG file updates) it wouldn't contribute to that. The changes that went into 1.0.6.1 are significant where the SoundManager is concerned.
With 1.0.6.1 I no longer replace the SoundManager class in Minecraft. I made this change to fix a variety of other mod compatibility challenges that DS was having. The replacement code I did have could have been suppressing the NPE.
Here's a variant of the NPE: https://gist.github.com/LemADEC/00c1a9b6cfff7ff473236cb4c0861bb8 while opening a Carpenter's garage door manually. Could be some bad multithreading in that mod?
java.lang.NullPointerException: Unexpected error
at com.tmtravlr.soundfilters.ModifiedLWJGLOpenALSource.updateFilters(ModifiedLWJGLOpenALSource.java:159)
at com.tmtravlr.soundfilters.ModifiedLWJGLOpenALSource.stopped(ModifiedLWJGLOpenALSource.java:129)
at paulscode.sound.Source.playing(Source.java:1210)
at net.minecraft.client.audio.SoundManager$SoundSystemStarterThread.playing(SoundManager.java:500)
at net.minecraft.client.audio.SoundManager.func_148605_d(SoundManager.java:218)
at net.minecraft.client.audio.SoundHandler.func_73660_a(SourceFile:179)
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:2013)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898)
at net.minecraft.client.main.Main.main(SourceFile:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
Any chance for a fix on this or ideas how I can prevent this constant crash?
@syndicate25 Are you running with SoundFilters as well? If so, have you tried removing it to see if the problem goes away? I been studying these callstacks for a while and they aren't adding up. For example, the callstack LamDEC posted above the NPE occurs in getNormalizedPitch(). However, because of execution Minecraft would have called getNormalizedVolume() prior and that routine references the same fields that getNormalizedPitch() does, but getNormalizedPitch() is crashing with a null reference.
EDIT: Could you also get me your client log? I am fixing another issue and I am not 100% sure if this is the same or different.
@LemADEC Not sure if you are still interested in this, but if you have a client log of the crash there may be additional clues. With the 1.0.6.3 release I hook the getNormalizedVolume() routine and do some tracing and validation of parameters coming in. I believe based on the callstack of the original issue there should be log information related to the problem since getNormalizedVolume() occurs before getNormalizedPitch().
@OreCruncher Here's my client log. Note that this is after removing SoundFilters, because yes, I was using it, but still seem to be crashing.
Client log: https://paste.ubuntu.com/p/JJ4Fqmy7Fn/
Latest crash report: https://pastebin.com/9VLBCjyz
This was what I was looking for:
[19:31:16] [Client thread/WARN]: getNormalizedVolume(): Null poolEntry parameter
Were you doing anything specific at the time?
I was just wandering around. I wasn't in new territory or anything, just kind of bouncing between structures in my base.
OK. Something appears to be inconsistent inside of SoundManager's tracking data. I am going to patch-up getNormalizedPitch() using ASM to check for bad parms and return 0 pitch if something funky is going on. Things should clean themselves up once the sound ends playing.
Pushed a v1.0.6.4 with the patch. Let me know the results. If weirdness still continues I will need any crash logs as well as the client log.
@syndicate25 I was wondering if you had a chance to look at the update and whether or not it fixed the issue.
@OreCruncher - a few of my players have been on and haven't said anything about crashes. I haven't been able to test it myself yet. I can reopen this issue if it persists when I get a chance to try it out.
Cool! Sorry for taking so long to get to this. It's been bubbling in the back of my mind for a while and between my other mods and RL things just went sideways.
Having the same issue here. Is there a workaround or a version that will not cause this issue?
java.lang.NullPointerException: Unexpected error
at net.minecraft.client.audio.SoundManager.func_148606_a(SoundManager.java:389)
at net.minecraft.client.audio.SoundManager.func_148605_d(SoundManager.java:204)
at net.minecraft.client.audio.SoundHandler.func_73660_a(SourceFile:179)
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:2013)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898)
at net.minecraft.client.main.Main.main(SourceFile:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)A detailed walkthrough of the error, its code path and all known details is as follows:
-- Head --
Stacktrace:
at net.minecraft.client.audio.SoundManager.func_148606_a(SoundManager.java:389)
at net.minecraft.client.audio.SoundManager.func_148605_d(SoundManager.java:204)
at net.minecraft.client.audio.SoundHandler.func_73660_a(SourceFile:179)
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:2013)