Arduino IDE crashes while uploading to board

Hi,

I have a problem, which is every time I try to upload a sketch to a board, the IDE crashes. I've tried uploading to both Arduino Uno and Mega 2560. Both have the same issue. My first thought was that it is a Java problem, but after looking at the error log, I'm not longer sure. I have to mention, I'm using Mac OSX Lion and Arduino 0101

Here is the error log:

Process: JavaApplicationStub [5731] Path: /Applications/Arduino.app/Contents/MacOS/JavaApplicationStub Identifier: cc.arduino.Arduino Version: 1.0.1 (0101) Code Type: X86 (Native) Parent Process: launchd [332]

Date/Time: 2012-07-20 15:35:18.182 -0400 OS Version: Mac OS X 10.7.4 (11E53) Report Version: 9

Crashed Thread: 21 Java: Thread-89

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x00000000b1fb4b70

VM Regions Near 0xb1fb4b70: Stack 00000000b1db6000-00000000b1eb4000 [ 1016K] rw-/rwx SM=COW --> Stack 00000000bc000000-00000000bf800000 [ 56.0M] ---/rwx SM=NUL

Application Specific Information: objc[5731]: garbage collection is OFF

Java information: Exception type: Bus Error (0xa) at pc=000000001fa0290c

Java VM: Java HotSpot(TM) Client VM (20.8-b03-424 mixed mode macosx-x86)

Current thread (00000000033a8400): JavaThread "Thread-89" [_thread_in_native, id=-1340592128, stack(00000000b0083000,00000000b0183000)] Stack: [00000000b0083000,00000000b0183000] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j gnu.io.RXTXPort.interruptEventLoop()V+0 j gnu.io.RXTXPort.removeEventListener()V+55 j gnu.io.RXTXPort.close()V+91 j processing.app.Serial.dispose()V+57 j processing.app.debug.Uploader.flushSerialBuffer()V+64 j processing.app.debug.AvrdudeUploader.uploadViaBootloader(Ljava/lang/String;Ljava/lang/String;)Z+854 j processing.app.debug.AvrdudeUploader.uploadUsingPreferences(Ljava/lang/String;Ljava/lang/String;Z)Z+154 j processing.app.Sketch.upload(Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/String;+14 j processing.app.Sketch.exportApplet(Ljava/lang/String;Z)Z+53 j processing.app.Sketch.exportApplet(Z)Z+8 j processing.app.Editor$DefaultExportHandler.run()V+29 j processing.app.Editor$DefaultExportHandler.run()V+91 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub

Java Threads: ( => current thread ) 00000000033a0c00 JavaThread "Image Fetcher 1" daemon [_thread_blocked, id=-1312100352, stack(00000000b1baf000,00000000b1caf000)] 0000000003c57800 JavaThread "Image Fetcher 0" daemon [_thread_blocked, id=-1313157120, stack(00000000b1aad000,00000000b1bad000)] =>00000000033a8400 JavaThread "Thread-89" [_thread_in_native, id=-1340592128, stack(00000000b0083000,00000000b0183000)] 0000000003b9a800 JavaThread "DestroyJavaVM" [_thread_blocked, id=-1332187136, stack(00000000b0187000,00000000b0987000)] 000000000344d800 JavaThread "TimerQueue" daemon [_thread_blocked, id=-1309986816, stack(00000000b1db3000,00000000b1eb3000)] 0000000003467c00 JavaThread "Timer-0" daemon [_thread_blocked, id=-1311043584, stack(00000000b1cb1000,00000000b1db1000)] 0000000003431400 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=-1314213888, stack(00000000b19ab000,00000000b1aab000)] 0000000003ca3400 JavaThread "Poller SunPKCS11-Darwin" daemon [_thread_blocked, id=-1315270656, stack(00000000b18a9000,00000000b19a9000)] 0000000003c9e400 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=-1316327424, stack(00000000b17a7000,00000000b18a7000)] 0000000003ca5800 JavaThread "AWT-Shutdown" [_thread_blocked, id=-1318449152, stack(00000000b15a1000,00000000b16a1000)] 0000000003ca5000 JavaThread "AWT-AppKit" daemon [_thread_in_native, id=-1403710784, stack(00000000bf800000,00000000c0000000)] 0000000003c53800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=-1320562688, stack(00000000b139d000,00000000b149d000)] 0000000003c52800 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=-1321619456, stack(00000000b129b000,00000000b139b000)] 0000000003c51800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=-1322676224, stack(00000000b1199000,00000000b1299000)] 0000000003c50800 JavaThread "Surrogate Locker Thread (Concurrent GC)" daemon [_thread_blocked, id=-1323732992, stack(00000000b1097000,00000000b1197000)] 0000000003c4b800 JavaThread "Finalizer" daemon [_thread_blocked, id=-1324789760, stack(00000000b0f95000,00000000b1095000)] 0000000003c4a800 JavaThread "Reference Handler" daemon [_thread_blocked, id=-1325846528, stack(00000000b0e93000,00000000b0f93000)] Other Threads: 0000000003c47c00 VMThread [stack: 00000000b0d91000,00000000b0e91000] [id=-1326903296] 0000000003c55000 WatcherThread [stack: 00000000b149f000,00000000b159f000] [id=-1319505920]

Thread 0:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x9bffdc22 mach_msg_trap + 10 1 libsystem_kernel.dylib 0x9bffd1f6 mach_msg + 70 2 com.apple.CoreFoundation 0x93cfc9da CFRunLoopServiceMachPort + 170 3 com.apple.CoreFoundation 0x93d05b04 __CFRunLoopRun + 1428 4 com.apple.CoreFoundation 0x93d051dc CFRunLoopRunSpecific + 332 5 com.apple.CoreFoundation 0x93d05088 CFRunLoopRunInMode + 120 6 com.apple.HIToolbox 0x93717723 RunCurrentEventLoopInMode + 318 7 com.apple.HIToolbox 0x9371ea8b ReceiveNextEventCommon + 381 8 com.apple.HIToolbox 0x9371e8fa BlockUntilNextEventMatchingListInMode + 88 9 com.apple.AppKit 0x9737b0d8 _DPSNextEvent + 678 10 com.apple.AppKit 0x9737a942 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 113 11 libawt.jnilib 0x1af05275 -[NSApplicationAWT nextEventMatchingMask:untilDate:inMode:dequeue:] + 132 12 com.apple.AppKit 0x97376cb1 -[NSApplication run] + 911 13 libawt.jnilib 0x1af03598 +[AWTStarter startAWT:] + 2019 14 libawt.jnilib 0x1af02d65 -[CPerformer perform] + 259 15 com.apple.CoreFoundation 0x93d64d11 -[NSObject performSelector:withObject:] + 65 16 com.apple.Foundation 0x9bad6e0c __NSThreadPerformPerform + 503 17 com.apple.CoreFoundation 0x93cdc13f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 15 18 com.apple.CoreFoundation 0x93cdbaf6 __CFRunLoopDoSources0 + 246 19 com.apple.CoreFoundation 0x93d059c8 __CFRunLoopRun + 1112 20 com.apple.CoreFoundation 0x93d051dc CFRunLoopRunSpecific + 332 21 com.apple.CoreFoundation 0x93d05088 CFRunLoopRunInMode + 120 22 com.apple.JavaApplicationLauncher 0x00006268 startupJava(LauncherArgsStruct*) + 304 23 com.apple.JavaApplicationLauncher 0x00009095 launchJavaApplicationWithJVMInfo + 1401 24 com.apple.JavaApplicationLauncher 0x0000599f launchJavaApplication + 39 25 cc.arduino.Arduino 0x00001e8a 0x1000 + 3722 26 cc.arduino.Arduino 0x00001cec 0x1000 + 3308 27 cc.arduino.Arduino 0x00001c19 0x1000 + 3097

Thread 21 Crashed:: Java: Thread-89 0 librxtxSerial.jnilib 0x1fa0290c Java_gnu_io_RXTXPort_interruptEventLoop + 137 1 ??? 0x0400b9d9 0 + 67156441 2 ??? 0x04003e31 0 + 67124785 3 ??? 0x04003e31 0 + 67124785 4 ??? 0x04003e31 0 + 67124785 5 ??? 0x04003e31 0 + 67124785 6 ??? 0x04003e31 0 + 67124785 7 ??? 0x0400405d 0 + 67125341 8 ??? 0x0400405d 0 + 67125341 9 ??? 0x04003f97 0 + 67125143 10 ??? 0x0400405d 0 + 67125341 11 ??? 0x0400405d 0 + 67125341 12 ??? 0x04003e31 0 + 67124785 13 ??? 0x0400430d 0 + 67126029 14 ??? 0x04001374 0 + 67113844 15 libjvm.dylib 0x028adc57 0x2800000 + 711767 16 libjvm.dylib 0x028ad9c9 0x2800000 + 711113 17 libjvm.dylib 0x028ba391 0x2800000 + 762769 18 libjvm.dylib 0x028ba221 0x2800000 + 762401 19 libjvm.dylib 0x028ba19f 0x2800000 + 762271 20 libjvm.dylib 0x028b9ff9 0x2800000 + 761849 21 libjvm.dylib 0x028b9e37 0x2800000 + 761399 22 libjvm.dylib 0x028140dc 0x2800000 + 82140 23 libsystem_c.dylib 0x9177ded9 _pthread_start + 335 24 libsystem_c.dylib 0x917816de thread_start + 34

Thread 21 crashed with X86 Thread State (32-bit): eax: 0x00000000 ebx: 0x1fa02891 ecx: 0xb018287c edx: 0xffffffff edi: 0x00000036 esi: 0xb1fb4a30 ebp: 0xb0182908 esp: 0xb01828e0 ss: 0x00000023 efl: 0x00010286 eip: 0x1fa0290c cs: 0x0000001b ds: 0x00000023 es: 0x00000023 fs: 0x00000023 gs: 0x0000000f cr2: 0xb1fb4b70 Logical CPU: 0

It is not the complete log, but I think this is sufficient enough. Any help/advise is appreciated! :)

First of all, check for software updates, then reboot and try again. If it continues, delete everything related to the Arduino IDE, download it again, and see what happens.

I have done exactly that, but it did not fix the problem.

themessedupone: My first thought was that it is a Java problem, but after looking at the error log, I'm not longer sure.

Really? Even though the log clearly says it crashes in a Java thread?

themessedupone: Thread 21 Crashed:: Java: Thread-89 0 librxtxSerial.jnilib 0x1fa0290c Java_gnu_io_RXTXPort_interruptEventLoop + 137

Looks like when the IDE polls the serial port, it causes problems. (I'm not positive, just guessing.)

Just for test, you might download 1.0 (or even 0023) of the Arduino IDE to see if you get any difference.

themessedupone: My first thought was that it is a Java problem, but after looking at the error log, I'm not longer sure.

Well, yes and no. It is a failure in a third-party that Arduino uses, but the failure is a classic segmentation fault in some JNI native code related to that third-party.

This is happening at the end of the upload when it is closing down the serial port.

Does it succeed uploading the sketch? That is, does a simple sketch actually just run when you reset the device?

Check your ~/Library/Logs/CrashReporter folder for recent Arduino or Java crash logs. One of those might have some interesting info about the native failure.

[Later]

This looks like the culprit, or is related: http://mailman.qbang.org/pipermail/rxtx/2009-February/10896777.html

Assuming you have an Arduino device that needs the FTDI drivers, are they reasonably up-to-date?

Okay, I downloaded librxtxSerial.jnilib for Java 6 from http://iharder.sourceforge.net/current/java/ and replaced it with the old librxtxSerial.jnilib file in /library/Java/Extensions. It fixed the problem!

I had the same problem. I replaced the librxtxSerial.jnlin and RXTXcomm.jar in /Library/Java/Extensions with the same files provide by the Arduino IDE /Applications/Arduino/Contenst/Resources/Java/

And It work out!!!

Check this link: http://arduino.cc/forum/index.php?topic=70075.0;wap2