<Sound Dev> [10] Review Request: 8178403 DirectAudio in JavaSound may hang and leak
Sergey Bylokhov
sergey.bylokhov at oracle.com
Wed Jul 5 14:56:42 UTC 2017
Hello,
Please review the fix for jdk10.
Bug: https://bugs.openjdk.java.net/browse/JDK-8178403
Webrev can be found at: http://cr.openjdk.java.net/~serb/8178403/webrev.00
This fix is updated version of JDK-8168751[1].
The problem is in this lines of code
1349 while (thread == curThread) {
1350 // doIO is volatile, but we could check it, then get
1351 // pre-empted while another thread changes doIO and notifies,
1352 // before we wait (so we sleep in wait forever).
1353 synchronized(lock) {
1354 if (!doIO) {
1355 try {
1356 lock.wait();
"thread == curThread" is executed outside the synchronized block, so it is possible that this condition will be changed after if() but before "lock.wait();", so the code will waits forever because nobody will call lock.notifyAll().
Also the fix calls the "lock.wait();" in the loop, so we will have two symmetric loops one to wait() and one to play().
The test is updated to reproduce the bug more often.
[1] https://bugs.openjdk.java.net/browse/JDK-8168751
More information about the sound-dev
mailing list