Multi-threaded sound crashes

Hello, I’ve been working on a danmaku shoot-em-up game using my own game engine for a while now. In my game, there are usually many bullets being fired by both the player and the enemies. So I built my sound code so using threads to handle each instance of a sound playing. This enables multiple instances of a sound to be played at the same time.

This works completely fine for me! For one of my testers though, the game and his JRE randomly crashes when it finishes playing sounds without throwing any sort of exception. He’s sent me his log file, and the problem seems to occur where I drain the remaining data from the sound’s line after reading it in.

I’ve posted my question on Stack Overflow, with an SSCCE to demonstrate my problem. I’ve also provided there a log generated by my tester’s JRE upon the crash So instead of reposting it here, here’s the link: http://stackoverflow.com/questions/9142967/java-multi-threaded-sound-crash

Any insight from you sound/threading gurus out there would be helpful.

Maybe use Paul Lamb Sound Library if you don’t succeed in using Java Sound in multi-threaded context.