Monday, June 9, 2008

Flex debugger crashing Eclipse, Safari then syslogd hogging CPU on Mac OS X (10.5.3)

Yesterday I had one of those nightmare days when suddenly your development environment no longer works for no apparent reason.

What was happening is that I was using the Eclipse Flex 3 plugin to develop an application. Nothing out of the ordinary and I've been doing this for sometime with no major issuers - yes occasionally Safari would crash but that is expected when your developing apps. Yesterday I was trying to profile my app and didn't seem to work. I thought OK my app isn't profiling and wasn't too concerned about it so went back to developing. Next thing I knew I could no longer debug.

First sign was Safari was hanging followed by the syslogd process eating up the processor. Then after a while Eclipse would also become unresponsive. My gut feeling was that this process called syslogd was the culprit but I was wrong - it was just a symptom. syslogd is just a daemon for syslog calls and killing the process might free up resources but did not resolved the issue. In my searching I found that syslogd will hog your processor if you have an application causing some sort of error. This was exactly what was occurring for me and my efforts to kill it and then reset it was a waste of time. I noticed my log file for errors was huge ~ 1 G plus and for a new MacBook Pro I knew it was something else but what? Last week I installed the new update for OS X 10.5.3 but that was not the issue either. My logs were filled with the same message over and over again.

!ENTRY com.adobe.flexbuilder.debug 4 2 2008-06-10 08:50:16.797
!MESSAGE Problems occurred when invoking code from plug-in: "com.adobe.flexbuilder.debug".
!STACK 0
java.lang.NullPointerException
at com.adobe.flexbuilder.debug.breakpoints.FlexLineBreakpoint.findSourceFiles(FlexLineBreakpoint.java:388)
at com.adobe.flexbuilder.debug.breakpoints.FlexLineBreakpoint.instantiate(FlexLineBreakpoint.java:442)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget.breakpointAdded(FlexDebugTarget.java:889)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread.installDeferredBreakpoints(FlexDebugTarget.java:539)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread.advanceStateMachine(FlexDebugTarget.java:570)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread.access$6(FlexDebugTarget.java:544)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$1.run(FlexDebugTarget.java:646)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:843)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread.eventLoop(FlexDebugTarget.java:626)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread.run(FlexDebugTarget.java:687)
at java.lang.Thread.run(Thread.java:613)



I tried reinstalling Flex 3, using Eclipse 3.3 instead of 3.2.2, installing Flex 3 Builder as standalone app, installing the flash debugger again and new versions of it. I was also googling for my life trying to find an issue but with these types of bugs you really need the right keyword to strike gold. Fortunately I did and found a thread on ProfilerAgent.swf preventing debugging which described my situation and had a solution. For whatever reasons the Flex profiler was the reason my debugger would crash and all I had to do was to delete the first line from mm.cfg file. The first line had the following

PreloadSwf=/Users/[username]/Documents/workspace/
.metadata/.plugins/com.adobe.flash.profiler/
ProfilerAgent.swf?host=localhost&port=9999


So each time the debugger would start it would start up the profiler as well. It was creating all the errors which syslogd was trying to handle. Really a question for Flex team on how it got there but for the moment it is gone. I haven't tried profiling again but will do so once I've caught up on the day I lost to this bug. I hope this post is helpful to others effected by this bug.

11 comments:

Anonymous said...

Wow Thanks that saved my day, I had the same problem after trying to Profile one of my apps. The Profiler would let me Profile it externally but not a native Flex app. Also I still cant Profile after removing the affending line of code but at least it didnt come back!
Cheers
Anthony

BetaDesigns

Anonymous said...

Thank you so much for your post, you saved at least one poor soul. I got as far as seeing the Java errors in the syslog and wondering why the profiler was starting up, but finally finding your post saved the day.

Oliver O'Mahony said...

Thanks very much for this. Solved my problem! :)

Anonymous said...

Wow, thank you so much for this. I was pulling my hair out for a week trying to figure out why my debugger stopped working. I think I reinstalled the player and flex builder 5 times before I saw your solution, oh well... thank you!

judge said...

Great Post. Thanks for being part of the community. Please notify adobe of this - votes are important. As they say, early and often...http://bugs.adobe.com/flex/

Anonymous said...

Thank you very much!!! Same problem here und now gone. The mm.cfg also affects the Flash IDE, where it throws the following error (compiling an fresh and clean movie!):

Error: Error #2030: Das Dateiende wurde erkannt.
at flash.utils::ByteArray/readUnsignedShort()
at ProfilerAgent/isDebugSWF()[C:\faramir\flex\sdk\modules\profiler3\as\ProfilerAgent.as:562]
at ProfilerAgent/allCompleteHandler()[C:\faramir\flex\sdk\modules\profiler3\as\ProfilerAgent.as:309]

I think, the problematic line has been inserted into the mm.cfg file when I canceled debug compiling in Flex.

The Flex console writes "[Unload SWF] unknown". I´m pasting this here just for other google searchers.

Anonymous said...

Thanks for this post, saved me a lot of time.

Anonymous said...

Great post! I was searching all over the web to find a solution for this bug. I found a related bug at Adobe http://bugs.adobe.com/jira/browse/FB-13554 but no solution. Maybe your thread could be a workaround too, though it seems to be fixed in the next version.

Unknown said...

Your solution saved my time. Appreciated it

Hot Breeze! said...

Thanks! This bug is still open, considering the earliest post, and it fixed my issue.

marshall said...

Just had a similar issue. My debugger failed completely in FlashBuilder4. All I would get in debug mode is the following:

"[Unload SWF] unknown"

I rebuilt my mm.cfg to fix it -- this article led me to that solution, so thanks! I also found this really outstanding article about options for that file:

http://jpauclair.net/2010/02/10/mmcfg-treasure/