Skip to content
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

Sound system incompatibilities can cause crashes #12

Closed
blakangel opened this issue Aug 29, 2022 · 13 comments
Closed

Sound system incompatibilities can cause crashes #12

blakangel opened this issue Aug 29, 2022 · 13 comments
Labels
fixed Something is working properly again

Comments

@blakangel
Copy link

Basic details

  • Are you using a legitimate Minecraft account?: YES
  • Are you using Java 8, 64-bit?: YES
  • Did you add any additional mods: NO
  • Crash/latest log link (if applicable): https://mclo.gs/wUFfeJn

Describe the issue
Made a tree tap and right clicking on rubber tree resin reliably causes a crash.

@blakangel blakangel added the auto: bug This bug report hasn't been looked at yet label Aug 29, 2022
@blakangel
Copy link
Author

Looks like disabling IC2 sounds in the settings fixes this for me. No crashes when using tree tap.

@xJon
Copy link
Owner

xJon commented Aug 29, 2022

I'm unable to reproduce this, but if you can reliably cause a crash I'll refer this to the IC2 Classic developer.
Do you have any unique information about your system you can share?

@Speiger
Copy link

Speiger commented Aug 29, 2022

Looks like your game doesn't support quick play of sounds.
(Playing sounds only once)

That can be either due to old hardware or I dunno?

@xJon xJon added cannot reproduce Difficult to resolve, cannot reproduce issue and removed auto: bug This bug report hasn't been looked at yet labels Aug 29, 2022
@JS19000
Copy link

JS19000 commented Aug 29, 2022

@xJon I'm having the exact same issue. Here's the log. https://mclo.gs/Dco6c1o
I've also installed OptiFine 1.12.2 HD U G5
The log shows that I'm using Windows 8.1 but I'm actually using Windows 10 21H2 build 19044.1889.

@Speiger
Copy link

Speiger commented Aug 29, 2022

@JS19000 IC2Classic doesn't support optifine. Sooo please repeate without Optifine

@JS19000
Copy link

JS19000 commented Aug 29, 2022

@Speiger It behaves the same with or without OptiFine but I think I just figured out the issue. I have an external USB Amp/DAC so if I turn it off Windows will switch to a new default device. If I turn it back on it will become the default device again but there will still be no sound in Minecraft. It doesn't switch back even though that's what it was using originally. If I go to output devices in Minecraft under the music & sound options and either click on my USB DAC or default devices to get the sound back and then click on a rubber tree it will crash. It will continue to crash until the application is restarted. It won't crash with or without OptiFine if the sound device isn't changed before then.

@blakangel
Copy link
Author

My issue seems similar to @JS19000 's - I'm using a Denon Home Theater Receiver as my audio output (HDMI from GPU -> Denon -> LCD). My crashes were probably related to the default device going away and coming back. I also lose sound in minecraft if I mute/unmute speakers in windows. To get sound back I have to select the correct sound device in minecraft settings as opposed to "default device".

I'll re-enable IC2 sounds today and try to replicate above scenarios.

@xJon xJon added minor bug Something is slightly not working properly and removed cannot reproduce Difficult to resolve, cannot reproduce issue labels Aug 29, 2022
@xJon xJon changed the title crash when using tree tap on rubber tree resin Sound system incompatibilities can cause crashes Aug 29, 2022
@embeddedt
Copy link

@Speiger The root cause of this crash seems to be that randomNumberGenerator is set back to null in SoundSystem when the sound device goes missing (presumably causing SoundSystem.cleanup to be called). The SoundSystem.quickXXXX family of methods seem to be the only ones that make use of that field, and are presumably only used by IC2C, which is why the crash happens.

We can fix vanilla to not shutdown the SoundSystem in this scenario, but I would recommend adding a try-catch block inside IC2C so that failure to play the sound does not result in an immediate game crash.

@Speiger
Copy link

Speiger commented Aug 30, 2022

Yeah I am not adding a try catch for that. That is not a fix to the system. It is just treating a symptom.
I think I know how to fix this but this will take time since the 1.19 beta is right now running and i am 100% utilized during that.

What the fix is going to be, since the old sound system is ditched that would mean a new one was created. So I can test for a ditched sound system and fetch the new one.

But yeah this is like a really bad edge case that I couldn't have known of....

@Speiger
Copy link

Speiger commented Aug 30, 2022

Also looking through the code.
A Resource Reload refreshes the sound system. So F3+T will fix it if you sound system changed.
That is a Temp fix for anyone having this issue. If the sound system breaks just use do texture reload.

@embeddedt
Copy link

What the fix is going to be, since the old sound system is ditched that would mean a new one was created. So I can test for a ditched sound system and fetch the new one.

This does not seem to happen on Linux. The game is not smart enough to properly reset the system so it can play any other sounds. You just get no sound unless you restart (or use F3+T, see below).

Maybe there is a new SoundSystem instance created, but the instance doesn't actually function.

A Resource Reload refreshes the sound system. So F3+T will fix it if you sound system changed.

This does fix the issue but resource reloads often take several minutes in modded games. I don't think this is a very practical solution.

@Speiger
Copy link

Speiger commented Aug 30, 2022

@embeddedt until i publish a proper fix the F3+T is your temp solution from preventing crashes.
You either take it or leave it until my patch comes out in a couple weeks.

@xJon xJon added bug Something isn't working properly and removed minor bug Something is slightly not working properly labels Aug 30, 2022
@xJon
Copy link
Owner

xJon commented Sep 3, 2022

Resolved in 1.0.1 thanks to @embeddedt's mixin fix, as a temporary solution until IC2C updates :)

@xJon xJon closed this as completed Sep 3, 2022
@xJon xJon added fixed Something is working properly again and removed bug Something isn't working properly labels Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Something is working properly again
Projects
None yet
Development

No branches or pull requests

5 participants