[FIXED] OpenAl crashes while unloading since 2.8.1

Started by Cero, October 23, 2011, 14:35:07

Previous topic - Next topic

Cero

Testing LWJGL version I have laying around:
2.8.4 nightly, error occurs
2.8.2 error occurs
2.8.0 error doesnt occur.

happens when closing the game, sound works fine (hence unloading)

also,
this total crash only happens like once every 10 times I try to exit a game, sometimes more often

but I always know when it CAN happen because I get this
AL lib: FreeContext: (1E5B0D88) Deleting 64 Source(s)

last line at all, this line only happens when its broken, so that sometimes, this crash occurs

Cero

I also read a thread in the Slick forum on cleaning up audio nicely.
So this involves a couple of commands, one of them

public static void detachBuffer(int sourceID) {
        //detach a buffer if it exists
        AL10.alSourceStop(sourceID);
        AL10.alSourcei(sourceID, AL10.AL_BUFFER, 0);
    }


now, AL10.alSourceStop(sourceID);, results in a
UnsatisfiedLinkError: org.lwjgl.openal.AL10.nalSourceStop(I)V

for me.

And yeah even with latest 2.8.4 & natives.

I even tried the very latest OpenAL32.dll
http://www.newdawnsoftware.com/jenkins/view/OpenAL/job/OpenAL-win32/
which seems to be triple size, that the one contained within the nightly lwjgl, but still this UnsatisfiedLinkError comes up.

Matzon


Cero

AL lib: GetConfigValue: Key general:hrtf_tables not found
AL lib: GetConfigValue: Key general:rt-prio not found
AL lib: GetConfigValue: Key general:resampler not found
AL lib: GetConfigValue: Key general:trap-alc-error not found
AL lib: GetConfigValue: Key general:trap-al-error not found
AL lib: GetConfigValue: Key reverb:boost not found
AL lib: GetConfigValue: Key reverb:emulate-eax not found
AL lib: GetConfigValue: Key general:drivers not found
AL lib: MMDevApiMsgProc: Starting message thread
AL lib: MMDevApiMsgProc: Starting message loop
AL lib: alc_initconfig: Initialized backend "mmdevapi"
AL lib: alc_initconfig: Added "mmdevapi" for playback
AL lib: alc_initconfig: Initialized backend "dsound"
AL lib: alc_initconfig: Added "dsound" for capture
AL lib: GetConfigValue: Key general:excludefx not found
AL lib: GetConfigValue: Key general:default-reverb not found
AL lib: GetConfigValue: Key general:channels not found
AL lib: GetConfigValue: Key general:sample-type not found
AL lib: GetConfigValue: Key general:format not found
AL lib: GetConfigValue: Key general:frequency not found
AL lib: GetConfigValue: Key general:periods not found
AL lib: GetConfigValue: Key general:period_size not found
AL lib: GetConfigValue: Key general:sources not found
AL lib: GetConfigValue: Key general:slots not found
AL lib: GetConfigValue: Key general:sends not found
AL lib: GetConfigValue: Key general:cf_level not found
AL lib: MMDevApiMsgProc: Got message 1024
AL lib: alcOpenDevice: Created device 0FAE0048, "Speakers (High Definition Audio
 Device)"
AL lib: UpdateDeviceParams: Format pre-setup: Stereo, Float, 44100hz, 1024 updat
e size x4
AL lib: MMDevApiMsgProc: Got message 1025
AL lib: UpdateDeviceParams: Format post-setup: Stereo, Float, 44100hz, 448 updat
e size x9
AL lib: GetConfigValue: Key general:layout_stereo not found
AL lib: GetConfigValue: Key general:layout not found
AL lib: GetConfigValue: Key general:hrtf not found
AL lib: UpdateDeviceParams: HRTF disabled
AL lib: UpdateDeviceParams: BS2B disabled
AL lib: UpdateDeviceParams: Stereo duplication disabled
AL lib: alcCreateContext: Created context 0FB0CD38
Sun Mar 04 05:01:50 CET 2012 INFO:- Sound works
Sun Mar 04 05:01:50 CET 2012 INFO:- 64 OpenAL source available
Sun Mar 04 05:01:50 CET 2012 INFO:- Sounds source generated
AL lib: FreeContext: 0FB0CD38
AL lib: FreeContext: (0FB0CD38) Deleting 64 Source(s)
AL lib: MMDevApiMsgProc: Got message 1026
AL lib: MMDevApiMsgProc: Got message 1027
AL lib: FreeDevice: 0FAE0048
AL lib: FreeDevice: (0FAE0048) Deleting 20 Buffer(s)
AL lib: alcMMDevApiDeinit: Sending WM_QUIT to Thread 0ec4
AL lib: MMDevApiMsgProc: Message loop finished

Cero

On my Windows XP laptop, OpenAl doesnt crash, but I still get that "AL lib: FreeContext: (0E45D108) Deleting 64 Source(s)" message.

Here the debug from there:
AL lib: GetConfigValue: Key general:hrtf_tables not found
AL lib: GetConfigValue: Key general:rt-prio not found
AL lib: GetConfigValue: Key general:resampler not found
AL lib: GetConfigValue: Key general:trap-alc-error not found
AL lib: GetConfigValue: Key general:trap-al-error not found
AL lib: GetConfigValue: Key reverb:boost not found
AL lib: GetConfigValue: Key reverb:emulate-eax not found
AL lib: GetConfigValue: Key general:drivers not found
AL lib: MMDevApiMsgProc: Starting message thread
AL lib: MMDevApiMsgProc: Failed to create IMMDeviceEnumerator instance: 0x800401
54
AL lib: alc_initconfig: Failed to initialize backend "mmdevapi"
AL lib: alc_initconfig: Initialized backend "dsound"
AL lib: alc_initconfig: Added "dsound" for playback
AL lib: alc_initconfig: Added "dsound" for capture
AL lib: GetConfigValue: Key general:excludefx not found
AL lib: GetConfigValue: Key general:default-reverb not found
AL lib: GetConfigValue: Key general:channels not found
AL lib: GetConfigValue: Key general:sample-type not found
AL lib: GetConfigValue: Key general:format not found
AL lib: GetConfigValue: Key general:frequency not found
AL lib: GetConfigValue: Key general:periods not found
AL lib: GetConfigValue: Key general:period_size not found
AL lib: GetConfigValue: Key general:sources not found
AL lib: GetConfigValue: Key general:slots not found
AL lib: GetConfigValue: Key general:sends not found
AL lib: GetConfigValue: Key general:cf_level not found
AL lib: DSoundEnumPlaybackDevices: Got device "SoundMAX HD Audio", GUID "{BD6DD7
1A-3DEB-11D1-B171-00C04FC20000}"
AL lib: alcOpenDevice: Created device 0E430048, "SoundMAX HD Audio"
AL lib: UpdateDeviceParams: Format pre-setup: Stereo, Float, 44100hz, 1024 updat
e size x4
AL lib: UpdateDeviceParams: Format post-setup: Stereo, Float, 44100hz, 1024 upda
te size x4
AL lib: GetConfigValue: Key general:layout_stereo not found
AL lib: GetConfigValue: Key general:layout not found
AL lib: GetConfigValue: Key general:hrtf not found
AL lib: UpdateDeviceParams: HRTF disabled
AL lib: UpdateDeviceParams: BS2B disabled
AL lib: UpdateDeviceParams: Stereo duplication disabled
AL lib: alcCreateContext: Created context 0E45D108
Sun Mar 04 04:59:32 CET 2012 INFO:- Sound works
Sun Mar 04 04:59:32 CET 2012 INFO:- 64 OpenAL source available
Sun Mar 04 04:59:32 CET 2012 INFO:- Sounds source generated
AL lib: FreeContext: 0E45D108
AL lib: FreeContext: (0E45D108) Deleting 64 Source(s)
AL lib: FreeDevice: 0E430048
AL lib: FreeDevice: (0E430048) Deleting 20 Buffer(s)
AL lib: alcMMDevApiDeinit: Sending WM_QUIT to Thread 0150

Cero

And tested on yet another PC, some Intel dual core with asus onboard sound

d:\DIST>java -Djava.library.path=lib -Xms128m -Xmx128m -jar jo.jar
Tue Mar 06 03:13:42 PST 2012 INFO:Initialising sounds..
AL lib: GetConfigValue: Key general:hrtf_tables not found
AL lib: GetConfigValue: Key general:rt-prio not found
AL lib: GetConfigValue: Key general:resampler not found
AL lib: GetConfigValue: Key general:trap-alc-error not found
AL lib: GetConfigValue: Key general:trap-al-error not found
AL lib: GetConfigValue: Key reverb:boost not found
AL lib: GetConfigValue: Key reverb:emulate-eax not found
AL lib: GetConfigValue: Key general:drivers not found
AL lib: MMDevApiMsgProc: Starting message thread
AL lib: MMDevApiMsgProc: Starting message loop
AL lib: alc_initconfig: Initialized backend "mmdevapi"
AL lib: alc_initconfig: Added "mmdevapi" for playback
AL lib: alc_initconfig: Initialized backend "dsound"
AL lib: alc_initconfig: Initialized backend "winmm"
AL lib: alc_initconfig: Added "winmm" for capture
AL lib: GetConfigValue: Key general:excludefx not found
AL lib: GetConfigValue: Key general:frequency not found
AL lib: GetConfigValue: Key general:format not found
AL lib: GetConfigValue: Key general:periods not found
AL lib: GetConfigValue: Key general:period_size not found
AL lib: GetConfigValue: Key general:sources not found
AL lib: GetConfigValue: Key general:slots not found
AL lib: GetConfigValue: Key general:sends not found
AL lib: GetConfigValue: Key general:cf_level not found
AL lib: MMDevApiMsgProc: Got message 1024
AL lib: alcOpenDevice: Created device 04F80048
AL lib: UpdateDeviceParams: Format pre-setup: Stereo, Signed Short, 44100hz, 102
4 update size x4
AL lib: MMDevApiMsgProc: Got message 1025
AL lib: UpdateDeviceParams: Format post-setup: Stereo, Signed Short, 44100hz, 89
6 update size x5
AL lib: GetConfigValue: Key general:layout_STEREO not found
AL lib: GetConfigValue: Key general:layout not found
AL lib: GetConfigValue: Key general:hrtf not found
AL lib: UpdateDeviceParams: HRTF disabled
AL lib: UpdateDeviceParams: BS2B disabled
AL lib: UpdateDeviceParams: Stereo duplication disabled
AL lib: alcCreateContext: Created context 04D40E80
Tue Mar 06 03:13:42 PST 2012 INFO:- Sound works
Tue Mar 06 03:13:42 PST 2012 INFO:- 64 OpenAL source available
Tue Mar 06 03:13:42 PST 2012 INFO:- Sounds source generated
AL lib: FreeContext: 04D40E80
AL lib: FreeContext: (04D40E80) Deleting 64 Source(s)
AL lib: MMDevApiMsgProc: Got message 1026
AL lib: MMDevApiMsgProc: Got message 1027
AL lib: FreeDevice: 04F80048
AL lib: FreeDevice: (04F80048) Deleting 1 Buffer(s)
AL lib: alcMMDevApiDeinit: Sending WM_QUIT to Thread 080c


Since this seems to work everywhere, I made this Dist you can run yourself to get this error:
http://www.mediafire.com/?65pm3itxc6q25ms
It differs how many times you have to run it to get a crash, sometimes its only 2 times, sometimes 12.
But here its very fast and its always < 20 for me.

All I do here is:
public static void main(String[] args) throws SlickException
{
	SoundStore.get().init();
	Sound snd = new Sound("content/audio/sound/novashot.ogg");
	AL.destroy();
}

Matzon

no crashing here... just the obligatory AL lib: FreeContext: message after lots of runs I get it too ... checking

Matzon

I've been debugging it last night with chris from openal. No clean fix yet.

The issue SEEMS to happen in the DllMain detach part when shutting down - specifically, the worker thread for the mmdev backend - we think - is scheduled to die (posting WM_QUIT), and is then run when the dll is unloaded (basically invalid address space).

Its not easy to fix, because openal does not have a "destroy" method to do cleanup in.

a simple fix, seems to do a Sleep(100) after posting the WM_QUIT message - but its ugly as hell, so probably wont go into OpenAL-Soft :)

So... shit out of luck for now .. .working on a fix ...

kappa

was able to reproduce the above bug on my vista machine too.

Cero

is it odd that the older version of lwjgl do not have this behavior ?
I understand you changed something with OpenAL @ 2.8.2

Matzon


Matzon

Please try the latest version of OpenAL (soon 1.14): http://www.newdawnsoftware.com/jenkins/view/OpenAL/
I cannot reproduce it anymore.


kappa


cmasupra

I have tested this using 2.8.4 and the 2.8.5 1714 nightly. I am still getting the error every time I close my game.

Edit: I tried replacing the 2.8.5 1714 nightly OpenAL dll files with the OpenAL dll files from 2.7.1, and I no longer got the "Deleting 64 source(s)" error. As soon as I switched back to the 2.8.5 OpenAL dll files, the error came back.