question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OpenAL Music Crashes on LWJGL3

See original GitHub issue

Issue details

Playing music on LWJGL3 crashes sometimes possibly due to synchronization issues.

How to reproduce

Based on my assessment, it’s possible for OpenALMusic.fill(…) to be called from multiple threads causing a buffer exception if 2+ threads manipulate tempBuffer at the same time. Attached is a player-submitted crash report. An example would be calling play from a non-render thread while the render-thread updates the audio at the same time.

Proposed solution

Maybe the easiest solution is to simply make the method synchronized:

private synchronized boolean fill (int bufferID) {
  ...
}

Version of LibGDX and/or relevant dependencies

libGDX 1.9.14 with LWJGL 3.2.3

Stacktrace

java.nio.BufferOverflowException
	at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:362)
	at com.badlogic.gdx.backends.lwjgl3.audio.OpenALMusic.fill(OpenALMusic.java:269)
	at com.badlogic.gdx.backends.lwjgl3.audio.OpenALMusic.update(OpenALMusic.java:237)
	at com.badlogic.gdx.backends.lwjgl3.audio.OpenALLwjgl3Audio.update(OpenALLwjgl3Audio.java:250)
	at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:133)
	at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:117)

Please select the affected platforms

  • Android
  • iOS
  • HTML/GWT
  • Desktop with LWJGL3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
mgsx-devcommented, Mar 12, 2021

@noblemaster ah yeah, you’re right about the loading case (or any other cases where GLThread is busy). I’d be happy to have music update/fill in a separated thread. +1 for that change.

0reactions
noblemastercommented, Mar 13, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

audio crash, win 10 :: TheoTown General Discussions
Mp3$Music.read(Mp3.java:91) at com.badlogic.gdx.backends.lwjgl3.audio. ... audio crash, win 10 ... OpenALMusic.update(OpenALMusic.java:238)
Read more >
[FIXED] OpenAl crashes while unloading since 2.8.1 - LWJGL Forum
[FIXED] OpenAl crashes while unloading since 2.8.1. ... this total crash only happens like once every 10 times I try to exit a...
Read more >
[MC-9974] Initialization of OpenAL fails sometimes - Jira
Occasionally when resources are loaded, OpenAL fails to start and there is no sound. Generally it works fine, but very rarely it fails....
Read more >
Game crashes on disasters or even small fire... - TheoTown
Just bought on steam and game keeps crashing when something gets destroyed, there's I would say there's slight chance of crash when tile...
Read more >
Newest 'openal' Questions - Page 3 - Stack Overflow
I am tasked to finding why this app stops the Music Player on my ipod. ... OpenAL application crashes/hangs when I pass non-nullptr...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found