Openjdk-tests: jdk_sound: javax/sound/midi/Devices/InitializationHang.java fails (MidiUnavailableException)

Created on 15 Jun 2017  路  7Comments  路  Source: AdoptOpenJDK/openjdk-tests

avax/sound/midi/Devices/InitializationHang.java fails with javax.sound.midi.MidiUnavailableException: Can not open line ... Caused by: java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian is supported.

20:53:10 HOME=/home/jenkins \
20:53:10 LANG=en_US.UTF-8 \
20:53:10 PATH=/bin:/usr/bin \
20:53:10 /home/jenkins/workspace/openjdk_test_x86-64_linux/openjdkbinary/j2sdk-image/jre/bin/../../bin/javac \
20:53:10 -J-ea \
20:53:10 -J-esa \
20:53:10 -J-Xmx512m \
20:53:10 -J-Dtest.src=/home/jenkins/workspace/openjdk_test_x86-64_linux/openjdk-test/OpenJDK_Playlist/openjdk-jdk8u/jdk/test/javax/sound/midi/Devices \
20:53:10 -J-Dtest.src.path=/home/jenkins/workspace/openjdk_test_x86-64_linux/openjdk-test/OpenJDK_Playlist/openjdk-jdk8u/jdk/test/javax/sound/midi/Devices \
20:53:10 -J-Dtest.classes=/home/jenkins/workspace/openjdk_test_x86-64_linux/jvmtest/OpenJDK_Playlist/SE80/work/classes/2/javax/sound/midi/Devices \
20:53:10 -J-Dtest.class.path=/home/jenkins/workspace/openjdk_test_x86-64_linux/jvmtest/OpenJDK_Playlist/SE80/work/classes/2/javax/sound/midi/Devices \
20:53:10 -J-Dtest.vm.opts='-ea -esa -Xmx512m' \
20:53:10 -J-Dtest.tool.vm.opts='-J-ea -J-esa -J-Xmx512m' \
20:53:10 -J-Dtest.compiler.opts= \
20:53:10 -J-Dtest.java.opts= \
20:53:10 -J-Dtest.jdk=/home/jenkins/workspace/openjdk_test_x86-64_linux/openjdkbinary/j2sdk-image/jre/bin/../.. \
20:53:10 -J-Dcompile.jdk=/home/jenkins/workspace/openjdk_test_x86-64_linux/openjdkbinary/j2sdk-image/jre/bin/../.. \
20:53:10 -J-Dtest.timeout.factor=4.0 \
20:53:10 -d /home/jenkins/workspace/openjdk_test_x86-64_linux/jvmtest/OpenJDK_Playlist/SE80/work/classes/2/javax/sound/midi/Devices \
20:53:10 -sourcepath /home/jenkins/workspace/openjdk_test_x86-64_linux/openjdk-test/OpenJDK_Playlist/openjdk-jdk8u/jdk/test/javax/sound/midi/Devices \
20:53:10 -classpath /home/jenkins/workspace/openjdk_test_x86-64_linux/openjdk-test/OpenJDK_Playlist/openjdk-jdk8u/jdk/test/javax/sound/midi/Devices:/home/jenkins/workspace/openjdk_test_x86-64_linux/jvmtest/OpenJDK_Playlist/SE80/work/classes/2/javax/sound/midi/Devices:/home/jenkins/workspace/openjdk_test_x86-64_linux/openjdkbinary/j2sdk-image/jre/bin/../../lib/tools.jar \
20:53:10 -XDignore.symbol.file=true /home/jenkins/workspace/openjdk_test_x86-64_linux/openjdk-test/OpenJDK_Playlist/openjdk-jdk8u/jdk/test/javax/sound/midi/Devices/InitializationHang.java
20:53:10 STDOUT:
20:53:10 STDERR:
20:53:10
20:53:10 ACTION: main -- Failed. Execution failed: main' threw exception: javax.sound.midi.MidiUnavailableException: Can not open line 20:53:10 REASON: Assumed action based on file name: run main InitializationHang 20:53:10 TIME: 1.705 seconds 20:53:10 messages: 20:53:10 command: main InitializationHang 20:53:10 reason: Assumed action based on file name: run main InitializationHang 20:53:10 Mode: othervm 20:53:10 elapsed time (seconds): 1.705 20:53:10 configuration: 20:53:10 STDOUT: 20:53:10 STDERR: 20:53:10 javax.sound.midi.MidiUnavailableException: Can not open line 20:53:10 at com.sun.media.sound.SoftSynthesizer.open(SoftSynthesizer.java:1155) 20:53:10 at com.sun.media.sound.SoftSynthesizer.open(SoftSynthesizer.java:1066) 20:53:10 at com.sun.media.sound.SoftSynthesizer.getReceiverReferenceCounting(SoftSynthesizer.java:1359) 20:53:10 at javax.sound.midi.MidiSystem.getReceiver(MidiSystem.java:273) 20:53:10 at InitializationHang.main(InitializationHang.java:36) 20:53:10 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 20:53:10 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 20:53:10 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 20:53:10 at java.lang.reflect.Method.invoke(Method.java:498) 20:53:10 at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:115) 20:53:10 at java.lang.Thread.run(Thread.java:748) 20:53:10 Caused by: java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian is supported. 20:53:10 at javax.sound.sampled.AudioSystem.getLine(AudioSystem.java:479) 20:53:10 at javax.sound.sampled.AudioSystem.getSourceDataLine(AudioSystem.java:606) 20:53:10 at com.sun.media.sound.SoftSynthesizer.open(SoftSynthesizer.java:1095) 20:53:10 ... 10 more 20:53:10 20:53:10 JavaTest Message: Test threw exception: javax.sound.midi.MidiUnavailableException: Can not open line 20:53:10 JavaTest Message: shutting down test 20:53:10 20:53:10 STATUS:Failed.main' threw exception: javax.sound.midi.MidiUnavailableException: Can not open line
20:53:10 rerun:
20:53:10 HOME=/home/jenkins \
20:53:10 LANG=en_US.UTF-8 \
20:53:10 PATH=/bin:/usr/bin \
20:53:10 CLASSPATH=/home/jenkins/workspace/openjdk_test_x86-64_linux/jvmtest/OpenJDK_Playlist/SE80/work/classes/2/javax/sound/midi/Devices:/home/jenkins/workspace/openjdk_test_x86-64_linux/openjdk-test/OpenJDK_Playlist/openjdk-jdk8u/jdk/test/javax/sound/midi/Devices:/home/jenkins/workspace/openjdk_test_x86-64_linux/openjdkbinary/j2sdk-image/jre/bin/../../lib/tools.jar:/home/jenkins/workspace/openjdk_test_x86-64_linux/openjdk-test/TestConfig/lib/jtreg/lib/javatest.jar:/home/jenkins/workspace/openjdk_test_x86-64_linux/openjdk-test/TestConfig/lib/jtreg/lib/jtreg.jar \
20:53:10 /home/jenkins/workspace/openjdk_test_x86-64_linux/openjdkbinary/j2sdk-image/jre/bin/../../bin/java \
20:53:10 -Dtest.src=/home/jenkins/workspace/openjdk_test_x86-64_linux/openjdk-test/OpenJDK_Playlist/openjdk-jdk8u/jdk/test/javax/sound/midi/Devices \
20:53:10 -Dtest.src.path=/home/jenkins/workspace/openjdk_test_x86-64_linux/openjdk-test/OpenJDK_Playlist/openjdk-jdk8u/jdk/test/javax/sound/midi/Devices \
20:53:10 -Dtest.classes=/home/jenkins/workspace/openjdk_test_x86-64_linux/jvmtest/OpenJDK_Playlist/SE80/work/classes/2/javax/sound/midi/Devices \
20:53:10 -Dtest.class.path=/home/jenkins/workspace/openjdk_test_x86-64_linux/jvmtest/OpenJDK_Playlist/SE80/work/classes/2/javax/sound/midi/Devices \
20:53:10 -Dtest.vm.opts='-ea -esa -Xmx512m' \
20:53:10 -Dtest.tool.vm.opts='-J-ea -J-esa -J-Xmx512m' \
20:53:10 -Dtest.compiler.opts= \
20:53:10 -Dtest.java.opts= \
20:53:10 -Dtest.jdk=/home/jenkins/workspace/openjdk_test_x86-64_linux/openjdkbinary/j2sdk-image/jre/bin/../.. \
20:53:10 -Dcompile.jdk=/home/jenkins/workspace/openjdk_test_x86-64_linux/openjdkbinary/j2sdk-image/jre/bin/../.. \
20:53:10 -Dtest.timeout.factor=4.0 \
20:53:10 -ea \
20:53:10 -esa \
20:53:10 -Xmx512m \
20:53:10 com.sun.javatest.regtest.agent.MainWrapper /home/jenkins/workspace/openjdk_test_x86-64_linux/jvmtest/OpenJDK_Playlist/SE80/work/javax/sound/midi/Devices/InitializationHang.d/main.0.jta
20:53:10
20:53:10 TEST RESULT: Failed. Execution failed: `main' threw exception: javax.sound.midi.MidiUnavailableException: Can not open line

bug linux

All 7 comments

Hi, I've been doing some strace on this and I found out that Java was trying to access some sound control devices and they weren't there.

Looking a little bit more I've found that it could be done by pulseaudio, I've installed it and looked good ( before I was having the same issue ).

screen shot 2017-06-24 at 10 20 33

Another thing is that the user that will start the tests must be part of audio group, eg:

audio:x:29:ubuntu,pulse

Shall I add this to Ansible scripts?

Yes please update the Ansible scripts Allan, and thank you for looking into this.

Nice! Thank you @smlambert.

@allandequeiroz Interesting the way you have debugged the issue out, can you share any resources or some writeup (in the form of a blog) on how it is done or how you did it, it will certainly help me and others understand and debug such systems.

Hey @neomatrix369 not anything fancy, the source is a guy that I worked with years ago.

Once I saw him using strace to see what was going on when he was executing one of our applications, how that was quite interesting.

What I did was just execute tests through strace. strace make test than traces and tests output started to appear in my terminal, when I saw the test failing I just stopped it and started to take a look, I've found some -1 EACCES (Permission denied) related to /dev/pts/*.

After that I googled for /dev/pts and found this page Man pts basically saying that a process try to open a channel to read and write data from/to a device through pseudoterminals.

At this point I was guessing that the problem could be something related to a lack of a "bridge" to application connect to a device or something like that, like the Display one, then I remembered about pulseaudio

PulseAudio is a sound server that is installed by default in most Debian desktop environments. It's main purpose is to provide a high level interface for controlling how multiple "sources" (programs that want to play sounds) are connected to "sinks" (sound cards).

I've decided to give it a try and I was luck.

@allandequeiroz That's some fine debugging :-)

Closing as now listed in summary issue #346

Was this page helpful?
0 / 5 - 0 ratings