7 Replies Latest reply on Mar 7, 2008 11:50 AM by 807557

    Assertion error using USB midi.


      I am trying the real time java for midi/sound. I am getting the following when I try to open my usb midi keyboard.

      java: ../../../src/rawmidi/rawmidi.c:264: snd_rawmidi_open_conf: Assertion `err >= 0' failed.
      Aborted (core dumped)

      Setup is linux ubuntu 7.10 with the rt kernel

      java version "1.5.0_13"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13_JavaRTS-2.1_EA-nb021_RTSJ-1.0.2)
      Java Real-Time System HotSpot(TM) Client VM (build 1.5.0_13, mixed mode)

      Kernel 2.6.22-14-rt #1 SMP PREEMPT RT Tue Feb 12 03:54:33 UTC 2008 x86_64 GNU/Linux

      Is this a bug ?

      cheers Paul.
        • 1. Re: Assertion error using USB midi.

          I'm not familiar with USB midi code - is that part of the JDK? Or it is part of a third-party library or your application?

          That assertion failure does not look like a VM/JDK failure as you aren't running as debug VM and hence no assertions are enabled.

          Other than that the error seems to indicate a failed system call. You might use strace to see which call is failing and what the error is - that might shed some light.

          Also can you run this code on a plain (non-real-time) VM ?

          David Holmes
          • 2. Re: Assertion error using USB midi.
            Hi David,

            Thanks for your reply,

            rawmidi.c is part of the alsa-lib .

            I am using the latest alsa-lib-1.0.16 and alsa-driver-1.0.16


            putting strace before the java command gives some more info.

            [snip lots of stuff]
            java: ../../../src/rawmidi/rawmidi.c:264: snd_rawmidi_open_conf: Assertion `err >= 0' failed.
            ) = ? ERESTART_RESTARTBLOCK (To be restarted)
            +++ killed by SIGABRT (core dumped) +++

            It happens when you try to open the midi input device.

            The code works fine with a plain 64bit VM.

            java -version
            java version "1.6.0_03"
            Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
            Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_03-b05, mixed mode)

            The java realtime works great for low latency audio (compared to plain java) it would be great to get my keyboard working!

            cheers Paul.
            • 3. Re: Assertion error using USB midi.

              Unfortunately there is nothing I can really do to help. The alsa-lib is not part of the JDK/VM and I have no idea why it might be failing. The strace output is not showing anything. The error comes from this call in snd_rawmidi_params():
               817      err = rawmidi->ops->params(rawmidi, params);
               818      if (err < 0)
               819           return err;
              but I don't know how to go any further.

              Sun Java RTS is not a 64-bit VM, does this work with a plain 32-bit VM?

              It might be that Sun Java RTS's use of memory locking is in someway incompatible with the alsa library, but I don't know why that might be the case.

              David Holmes
              • 4. Re: Assertion error using USB midi.
                Hi David,

                As you suggested I just tried tried the latest vanilla 32bit JVM and it also fails. So the real time java is off the hook.

                Is there a 64bit linux real time java in the pipeline?

                cheers Paul.
                • 5. Re: Assertion error using USB midi.

                  I would try installing the 32 bit version of ubuntu 7.10 If you do I would expect this issue to go away.
                  I think the problem is that the OS does not allow 32 bit apps to run on a 64 bit ONLY os.. At least
                  that has been my experience with ubuntu only. SuSE and Redhat don't have this issue nor does Solaris
                  10 x86.

                  Let me know if this ends up working after re-install.

                  • 6. Re: Assertion error using USB midi.
                    Gary: This site might assist with at least some 32-bit woes:


                    Paul: There are no announced plans for 64-bit real-time at this stage.

                    • 7. Re: Assertion error using USB midi.

                      I did a little reading . . . mixing 32bit and 64bit code is bad news.
                      It is quite interesting that the rest of code which uses the audio drivers worked perfectly!
                      It looks like the 32bit java calls the alsa-lib library which is 64bit. Is this the only place where this happens?

                      I think I could get round this problem by providing 32bit versions of the libraries. I embarked on creating a 32bit chroot cage
                      but it started to be hard work.

                      So I installed 32bit ubuntu and now the midi works fine.