-
Notifications
You must be signed in to change notification settings - Fork 97
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
Crash regarding xcb on Linux, Java 11+. Also Sound is buggy and doesn't work sometimes. #681
Comments
After closer inspection, you can see that the audio that does work is ALSA, but when it doesn't, it's just "Audio Stream" |
After playing more on that specific Java version, Java(TM) SE Runtime Environment (build 1.8.0_411-b09), the audio became significantly delayed, I did have a youtube video playing in the background is that makes a difference. But restarting the game multiple times fixes this and goes back to flickering, so audio is extremely inconsistent for some reason. |
Unfortunately, Java(TM) SE Runtime Environment (build 1.8.0_411-b09) still causes the xcb crash (same error message btw), but it's very inconsistent, sometimes I can play for more than 10 to 20 minutes and not encounter an issue and sometimes like just now it crashed within 5 minutes. I have no idea if xcb is an issue, but I can't seem to find a solution. |
After some tests with my Hyper-V Ubuntu 22.04.4 LTS machine, I have several discoveries with it. This also occurs even before the change to the audio system in 2.2.0 (2.2.0-dev7 by #544). With 1.8.0_402, game menu freezes after a play of audio; with 11.0.22, 17.0.10 or 21.0.2, significant delays can be noticed with audio. With 2.2.0, 1.8 gives no sound, and delays can still be noticed with the other 3 JRE versions. However, I cannot notice the flicks in PAVU Control and the crash messages of xcb. |
Furthermore, about the audio stream names: Before the change to the audio system mentioned, there are 10 streams all named "Java: Audio Clip", exactly as the number of audio files in game, as intended. After the change, 1.8 does indeed gives a single "Java: Audio Stream" audio stream and other versions give a "ALSA plug-in [java]: ALSA Playback" stream. I apologize that I missed the information that you have also tested with Oracle JRE 8, and it can indeed play audio with delays (seemingly with smaller delays), but I still cannot notice of the "flicks" of stream. It seems like OpenJDK JRE 8 is not linking with ALSA. In conclusion, I am not sure whether this issue is reported or occurred only during some specific circumstances. And maybe tests in other Linux may be conducted. I will try to debug with using Ubuntu if possible. |
Seems to work on my Steam Deck just fine, using SteamOS Holo 3.5.19 with Openlogic OpenJDK Java 8 JRE 8u352-b08-linux-64. Maybe that's because Steam Deck uses pipewire and not pulseaudio? Seems to connect to ALSA just fine. The exact same build of Java on my Ubuntu PC causes the ALSA flickering in pavucontrol. |
If that is the case that there are some issues with PulseAudio, we might have to check with it. |
Can you try the solution mentioned here (stackoverflow)? |
I have tried this and audio is now playing on my stock OpenJDK 8 but pavucontrol still flickers for some reason. minicraft-test.mp4The jitteryness is only noticeable when watching playback of a video, otherwise it's only partially noticeable |
It looks like there are some compatibility issues between PulseAudio and Java, and indeed OpenJDK 8 PulseAudio API/IcedTea is broken. The unstable connection between PulseAudio and Java may be caused by certain configurations, but more tests shall still be conducted. |
My test with OpenJDK 11 2024-05-25.14-50-58.mp4 |
My suggestion is to use PipeWire over PulseAudio. PipeWire is a newer package than PulseAudio, and the compatibility should be better. |
Another way is to reset the sound configurations to the default settings:
More Info: https://askubuntu.com/a/1259763 And you may try to spot out the problematic configs by reverting it to be the ones before resetting. |
I'm not doing that, I've tried setting it up and it's just a pain, especially on Ubuntu it seems. I do get that they're not the same or whatever, but I'm just wondering if a new sound system could solve this issue, as it shouldn't be up to the user to make changes to their system to have a game work as intended, the program should work on all systems and be compatible with not only pipewire but pulse too. Essentially, literally everything else works fine with Pulse so why should I have to switch just to play Minicraft, that just doesn't make any sense to me. This is a bug and I don't agree with the idea that the user changing their sound system from Pulse to Pipewire is the solution. |
The sound system we are currently using heavily relies on native Java sound libraries while Mincraft's LWJGL is using OpenAL for audio. I doubt that the Java native libraries have some problems tackling with audio on some Linux distributions. |
However, more than that, my 22.04 Ubuntu VM test (no custom settings) with PulseAudio does not come with flickering issue. I also guess that Java audio may not be compatible with certain configurations. |
What OpenJDK versions do you have on the VM and what is in the sound.properties file? |
The following is the setups and with the similar results with my tests:
They however sometimes come with significant audio latencies. |
Describe the bug
The game runs with no audio on OpenJDK Java 8, so I upgraded to 11, 17 and 21 and the game kept crashing with the exact same error message, that message being:
I am using OpenJDK.
I downloaded an official Java 8 binary from java.com and the game now works completely fine however, in
pavucontrol
the volume slider for the game is flickering. Heres a video (Java version here isJava(TM) SE Runtime Environment (build 1.8.0_411-b09)
):strange.webm
I genuinely find this to be so weird, even the recording software is not picking up the sound correctly.
To Reproduce
I have no idea if it is reproducable, it could be an issue with my machine but then again, what am I supposed to do about it? Other java applications like Minecraft work flawlessly on OpenJDK Java 8 and other versions like OpenJDK Java 17. So I'm pretty sure something is wrong with the game itself or it was not meant for anything except Java 8. If that's the case, I have no idea why sound isn't working on Java 8. Here's a video of sound not working on
OpenJDK Runtime Environment (build 1.8.0_402-8u402-ga-2ubuntu1~20.04-b06)
simplescreenrecorder-2024-05-20_20.26.22.mp4
Albeit this is a bad example because I didn't play any example audio from a browser or something, so the video just has no audio, but you can see from the pavucontrol that the java stream is not producing any audio.
Expected behavior
No crash. (and for sound to work)
Desktop (please complete the following information):
Additional Comments:
I personally don't know why this happens, even tried building on my own machine and same thing occurs. Sound works but stutters in Java 11+ and crashes with that error.
The text was updated successfully, but these errors were encountered: