mxj crashing?


    Jan 19 2010 | 3:34 pm
    Hi all,
    I'm getting reports that Max is crashing when opening a patch that contains my midifile java object (http://cnmat.berkeley.edu/downloads) under OSX 10.5.8 and Max 5.1.1. Both people report that this behavior is new since they upgraded to 5.1.1, so I'm wondering if anything in the mxj object has changed that I should know about. I can post a crashlog that was sent to me if that's useful. Unfortunately, since I can't reproduce the problem on OSX 10.6.1 and Max 5.1.1, I'm not sure how to go about fixing it...
    Thanks, JM

    • Feb 09 2010 | 11:17 pm
      Update:
      I've upgraded to OSX version 10.6.2 and version 5.1.2 (41620) of MaxMSP and I'm now experiencing the same behavior that various users have been telling me about. It's hard to tell, but it seems like it might be a problem with mxj since the same code that causes Max to crash, when modified slightly to run from the command line, runs just fine. I'm hoping someone at Cycling will have some insight into this. Maybe it has to do with java 6 that comes with the latest update of OSX?
      Thanks, JM
      //////////////////////////////////////////////// //MaxMSP code import com.cycling74.max.*; import javax.sound.midi.*;
      public class midifile extends MaxObject{ private Sequencer sequencer = null;
      public midifile(Atom[] args){ initSequence(); }
      private void initSequence(){ try{ //max crashes here sequencer = MidiSystem.getSequencer(false); }catch(MidiUnavailableException e){ e.printStackTrace(); } } }
      //////////////////////////////////////////////// //command line code import javax.sound.midi.*;
      public class midifile extends MaxObject{ private Sequencer sequencer = null;
      public static void main(String[] args){ midifile mf = new midifile(); mf.initSequence(); }
      private void initSequence(){ try{ //max crashes here sequencer = MidiSystem.getSequencer(false); }catch(MidiUnavailableException e){ e.printStackTrace(); } } }
      Here's the relevant part of the crash report:
      Process: MaxMSP [2905] Path: /Applications/Max5/MaxMSP.app/Contents/MacOS/MaxMSP Identifier: com.cycling74.MaxMSP Version: 5.1.2 (41620) (5.1.2) Code Type: X86 (Native) Parent Process: launchd [109]
      Date/Time: 2010-02-09 14:39:02.168 -0800 OS Version: Mac OS X 10.6.2 (10C540) Report Version: 6
      Interval Since Last Report: 26229 sec Crashes Since Last Report: 15 Per-App Interval Since Last Report: 13011 sec Per-App Crashes Since Last Report: 8 Anonymous UUID: 7C1A99DA-DB3C-46C4-877F-E434903CC1E0
      Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000 Crashed Thread: 0 Java: AWT-AppKit Dispatch queue: com.apple.main-thread
      Application Specific Information:
      Java information: Exception type: Bus Error (0xa) at pc=0x976dd8d0
      Java VM: Java HotSpot(TM) Client VM (14.3-b01-101 mixed mode macosx-x86)
      Current thread (0x1b800c00): JavaThread "AWT-AppKit" [_thread_in_native, id=-1609800448, stack(0xbf800000,0xc0000000)] Stack: [0xbf800000,0xc0000000] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j com.sun.media.sound.MidiInDeviceProvider.nGetName(I)Ljava/lang/String;+0 j com.sun.media.sound.MidiInDeviceProvider.access$100(I)Ljava/lang/String;+1 j com.sun.media.sound.MidiInDeviceProvider$MidiInDeviceInfo.(ILjava/lang/Class;)V+2 j com.sun.media.sound.MidiInDeviceProvider$MidiInDeviceInfo.(ILjava/lang/Class;Lcom/sun/media/sound/MidiInDeviceProvider$1;)V+3 j com.sun.media.sound.MidiInDeviceProvider.createInfo(I)Lcom/sun/media/sound/AbstractMidiDeviceProvider$Info;+17 j com.sun.media.sound.AbstractMidiDeviceProvider.readDeviceInfos()V+101 j com.sun.media.sound.AbstractMidiDeviceProvider.getDeviceInfo()[Ljavax/sound/midi/MidiDevice$Info;+1 j javax.sound.midi.MidiSystem.getFirstDevice(Ljavax/sound/midi/spi/MidiDeviceProvider;Ljava/lang/Class;ZZ)Ljavax/sound/midi/MidiDevice;+1 j javax.sound.midi.MidiSystem.getFirstDevice(Ljava/util/List;Ljava/lang/Class;ZZ)Ljavax/sound/midi/MidiDevice;+32 j javax.sound.midi.MidiSystem.getFirstDevice(Ljava/util/List;Ljava/lang/Class;)Ljavax/sound/midi/MidiDevice;+4 j javax.sound.midi.MidiSystem.getDefaultDevice(Ljava/lang/Class;)Ljavax/sound/midi/MidiDevice;+89 j javax.sound.midi.MidiSystem.getDefaultDeviceWrapper(Ljava/lang/Class;)Ljavax/sound/midi/MidiDevice;+1 j javax.sound.midi.MidiSystem.getSequencer(Z)Ljavax/sound/midi/Sequencer;+3 j midifile.initSequence()V+2 j midifile.([Lcom/cycling74/max/Atom;)V+10 v ~StubRoutines::call_stub
      Java Threads: ( => current thread ) 0x1b8cc800 JavaThread "AWT-Shutdown" [_thread_blocked, id=-1319698432, stack(0xb1470000,0xb1570000)] 0x1b8ba800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=-1322344448, stack(0xb11ea000,0xb12ea000)] 0x1b8b9c00 JavaThread "CompilerThread0" daemon [_thread_blocked, id=-1323401216, stack(0xb10e8000,0xb11e8000)] 0x1b8b8c00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=-1324457984, stack(0xb0fe6000,0xb10e6000)] 0x1b8b7c00 JavaThread "Surrogate Locker Thread (CMS)" daemon [_thread_blocked, id=-1325514752, stack(0xb0ee4000,0xb0fe4000)] 0x1b8ac800 JavaThread "Finalizer" daemon [_thread_blocked, id=-1326571520, stack(0xb0de2000,0xb0ee2000)] 0x1b8ab800 JavaThread "Reference Handler" daemon [_thread_blocked, id=-1327628288, stack(0xb0ce0000,0xb0de0000)] =>0x1b800c00 JavaThread "AWT-AppKit" [_thread_in_native, id=-1609800448, stack(0xbf800000,0xc0000000)] Other Threads: 0x1b8a7c00 VMThread [stack: 0xb0bde000,0xb0cde000] [id=-1328685056] 0x1b8c3800 WatcherThread [stack: 0xb12ec000,0xb13ec000] [id=-1321287680]
      VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None
      Heap par new generation total 14336K, used 2468K [0x1e010000, 0x1f010000, 0x1f3c0000) eden space 12288K, 20% used [0x1e010000, 0x1e279208, 0x1ec10000) from space 2048K, 0% used [0x1ec10000, 0x1ec10000, 0x1ee10000) to space 2048K, 0% used [0x1ee10000, 0x1ee10000, 0x1f010000) concurrent mark-sweep generation total 49152K, used 0K [0x1f3c0000, 0x223c0000, 0x2e010000) concurrent-mark-sweep perm gen total 12288K, used 4388K [0x2e010000, 0x2ec10000, 0x32010000)
      Virtual Machine Arguments: JVM Args: -Xincgc -Xms64m -Xmx256m Java Command: Launcher Type: generic Physical Memory: Page Size = 4k, Total = 2048M, Free = 282M
      Thread 0 Crashed: Java: AWT-AppKit Dispatch queue: com.apple.main-thread 0 com.apple.CoreFoundation 0x976dd8d0 CFStringGetCStringPtr + 128 1 libjsound.jnilib 0x34955eea Java_com_sun_media_sound_HAEShutdownHook_createNativeRef + 3284 2 libjsound.jnilib 0x3495602e Java_com_sun_media_sound_HAEShutdownHook_createNativeRef + 3608 3 libjsound.jnilib 0x34956159 Java_com_sun_media_sound_HAEShutdownHook_createNativeRef + 3907 4 libjsound.jnilib 0x349563b5 Java_com_sun_media_sound_HAEShutdownHook_createNativeRef + 4511 5 libjsound.jnilib 0x34956e79 Java_com_sun_media_sound_MidiInDeviceProvider_nGetName + 63 6 ??? 0x1c00b839 0 + 469809209 7 ??? 0x1c003f17 0 + 469778199 8 ??? 0x1c003f17 0 + 469778199 9 ??? 0x1c003db1 0 + 469777841 10 ??? 0x1c003db1 0 + 469777841 11 ??? 0x1c003f17 0 + 469778199 12 ??? 0x1c003db1 0 + 469777841 13 ??? 0x1c003f17 0 + 469778199 14 ??? 0x1c003f17 0 + 469778199 15 ??? 0x1c003f17 0 + 469778199 16 ??? 0x1c003f17 0 + 469778199 17 ??? 0x1c003f17 0 + 469778199 18 ??? 0x1c003f17 0 + 469778199 19 ??? 0x1c003f17 0 + 469778199 20 ??? 0x1c003db1 0 + 469777841 21 ??? 0x1c0012d3 0 + 469766867 22 libclient.dylib 0x1acea7d0 JVM_Lseek + 149024 23 libclient.dylib 0x1acea576 JVM_Lseek + 148422 24 libclient.dylib 0x1acea546 JVM_Lseek + 148374 25 libclient.dylib 0x1ad00230 JVM_MonitorWait + 15088 26 libclient.dylib 0x1aee49b1 pss + 425857 27 com.cycling74.mxj 0x1a7cba66 call_constructor_with_coercion + 418 28 com.cycling74.mxj 0x1a7cc880 construct + 228 29 com.cycling74.mxj 0x1a7ccdb2 maxjava_new + 1322 30 com.cycling74.MaxMSP 0x0001cb2f typedmess_fun + 1973 31 com.cycling74.MaxMSP 0x000bb079 object_new_typed_flags + 637 32 com.cycling74.MaxMSP 0x000bb0b8 object_new_typed + 46 33 com.cycling74.MaxMSP 0x00011781 newload_internal + 165 34 com.cycling74.MaxMSP 0x00011a86 newload + 40 35 com.cycling74.MaxMSP 0x0001cb2f typedmess_fun + 1973 36 com.cycling74.MaxMSP 0x0001cbb9 typedmess + 83 37 com.cycling74.MaxMSP 0x0001d225 aeval + 893 38 com.cycling74.MaxMSP 0x00008730 atombuf_eval + 152 39 com.cycling74.MaxMSP 0x001608e7 jnewobj_new + 2283 40 com.cycling74.MaxMSP 0x0001cb2f typedmess_fun + 1973 41 com.cycling74.MaxMSP 0x000bb03e object_new_typed_flags + 578 42 com.cycling74.MaxMSP 0x000bb0b8 object_new_typed + 46 43 com.cycling74.MaxMSP 0x0016e38e jpatcher_newobject + 380 44 com.cycling74.MaxMSP 0x0016e8a5 jpatcher_pastefromdictionary + 403 45 com.cycling74.MaxMSP 0x0017e180 jpatcher_fromdictionary + 1692 46 com.cycling74.MaxMSP 0x0017e516 jpatcher_new + 900 47 com.cycling74.MaxMSP 0x0001cb2f typedmess_fun + 1973 48 com.cycling74.MaxMSP 0x000bb079 object_new_typed_flags + 637 49 com.cycling74.MaxMSP 0x000bb0b8 object_new_typed + 46 50 com.cycling74.MaxMSP 0x00010cb3 jpatcher_load_fromdictionary(char*, short, object*, short, atom*) + 437 51 com.cycling74.MaxMSP 0x00010e32 jpatcher_load_frombuffer(char*, short, char const*, long, short, atom*) + 310 52 com.cycling74.MaxMSP 0x000110a1 jpatcher_load(char*, short, short, atom*) + 373 53 com.cycling74.MaxMSP 0x0001132f lowload_type + 597 54 com.cycling74.MaxMSP 0x00011c25 fileload_extended + 169 55 com.cycling74.MaxMSP 0x00012191 fileload_unique + 99 56 com.cycling74.MaxMSP 0x000121c4 fileload_type + 40 57 com.cycling74.MaxMSP 0x0001231a dropload + 340 58 com.cycling74.MaxMSP 0x00007c8e ae_openfile(FSRef*) + 60 59 com.cycling74.MaxMSP 0x00053283 sysiac_iterate + 223 60 com.cycling74.MaxMSP 0x00007d0f ae_docopen(AEDesc const*, AEDesc*, long) + 39 61 com.apple.AE 0x935b5f3a aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned long, unsigned char*) + 166 62 com.apple.AE 0x935b5e39 dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 43 63 com.apple.AE 0x935b5d46 aeProcessAppleEvent + 197 64 com.apple.HIToolbox 0x92be32a1 AEProcessAppleEvent + 50 65 com.cycling74.MaxMSP 0x002cd874 juce::juce_dispatchNextMessageOnSystemQueue(bool, bool) + 608 66 com.cycling74.MaxMSP 0x002d7413 juce::MessageManager::dispatchNextMessage(bool, bool*, bool) + 79 67 com.cycling74.MaxMSP 0x002d74d2 juce::MessageManager::runDispatchLoop() + 42 68 com.cycling74.MaxMSP 0x002d5e2d juce::JUCEApplication::main(juce::String&, juce::JUCEApplication*) + 605 69 com.cycling74.MaxMSP 0x002d5f07 juce::JUCEApplication::main(int, char**, juce::JUCEApplication*) + 125 70 com.cycling74.MaxMSP 0x001e051a main + 76 71 com.cycling74.MaxMSP 0x00005d52 _start + 216 72 com.cycling74.MaxMSP 0x00005c79 start + 41
    • Feb 10 2010 | 7:53 pm
      Hi John - if memory serves, there's a utility in Applications/Utilities called Java Preferences or something like that that allows one to easily change which Java version is run by the OS. So you can see there which Java version is being run, in case that has anything to do with it...
      Dan
    • Feb 12 2010 | 12:57 am
      and of course, now that i need this super handy midi-file thingy, there is this problem...thank you, apple. (anybody noticed, that in quicktime you can´t specify a soundbank for the quicktime synth anymore in neither version? - thats progress...but not for pros...)
      dan, i looked up the java-setup in utilities but couldn´t find any useful change. i tried with changing the order in which java looks for the at version, but that didn´t cure the problem.
      any other good idea?
      thanks hans
    • Feb 12 2010 | 6:01 pm
      I think the problem is in something that changed in OS X's Java support, and not Max - see this post for example...
      Still trying to come up with a solution, as I too use John's great midifile object!
      Dan
    • Feb 12 2010 | 6:47 pm
      I have not tried this yet, as I'm not on my Snow Leopard machine, but I may try this - basically reverting to Java 5 as a temporary workaround:
      Dan
    • Feb 12 2010 | 6:54 pm
      And one last clue - from the mmj website:
      Maybe flaky device name handling in the Java OS X code. That would sync up with where the crash happened - from the log above:
      j com.sun.media.sound.MidiInDeviceProvider.nGetName(I)Ljava/lang/String;+0
    • Mar 03 2010 | 6:59 pm
      I finally got around to reinstalling Java 5 using these instructions: http://www.macosxhints.com/article.php?story=20100123192950640 and it fixed the problem. Unfortunately, I think this is the only solution at this point.
      JM
    • Mar 04 2010 | 9:18 pm
      Thanks John - I also have had success in getting your midifile object working now, but on OS X 10.5.x (unfortunately the instructions you posted were for 10.6 only I think). I've confirmed that the problem was introduced starting with Java for Mac OS X 10.5 Update 6 (December 03, 2009) - this updates J2SE 5.0 to 1.5.0_22. I've semi-successfully downgraded to Java for Mac OS X 10.5 Update 5 now, which downgrades J2SE 5.0 to version 1.5.0_20. I say "semi" successfully downgraded because now I can't get the Java Preferences app to work... hopefully there are not other problems with my Java install.
      I used instructions instructions below, which only partially worked - I had to delete the version 1.5.0 folder completely, and then reinstall:
      and
    • Mar 15 2010 | 12:11 pm
      OK, I've now got things narrowed down to an incompatibility between Max's automatically created "to MaxMSP" and "from MaxMSP" virtual MIDI devices, and the latest Apple Java updates (Java for Mac OS X 10.6 Update 1 and Java for Mac OS X 10.5 Update 6, both of which I believe came out in early Dec, 2009).
      If I click on each of the messages in the patch below, and *then* instantiate your midifile object John, Max loads and uses it just fine.
      I've reported the problem to Cycling, we'll see if they can do anything about it...
      Dan