We are having challenges with an application we are developing using Titanium Appcelerator.

The application seems to crash at random moments during use. Upon closer investigation, the crash seems to occur during the opening or closing of windows within the app.

The structure of the app is such that it utilizes a navGroup to manage a hierarchy of windows.  There is a base window that serves as the home window for the application while the remaining app windows are opened as part of the navGroup and act as child windows to the home window.  Each window contains functionality for a major functional area of the application.

Each window is set up such that it runs in its own context (thread). Thus, each window is executing code that is contained in a separate JavaScript file. With that, the crash seems to occur when there is a context change in the form of opening or closing a window.

We’ve been able to capture the crash logs on an iPhone and they indicate that the application has crashed with either EXC_CRASH (SIGABRT) or EXC_BAD_ACCESS (SIGBUS) error.

We’re running Titanium Mobile version 1.7.2 in iOS 4.3.  The app has been run on an iPhone, iPad and iPod touch, all of which experience the crash.

Five submissions to the Appcelerator Community Q & A site make reference to this error. The URLs for three of the items are listed below:

(1)

http://developer.appcelerator.com/question/122433/crashing-in-ios-and-ios-simulator-using-sdk-171-when-removing-event-listeners

(2)

http://developer.appcelerator.com/question/123003/random-crashes-throughout-app-log-details-included-any-advice-is-appreciated

(3)

http://developer.appcelerator.com/question/57601/excbadaccess-sigbus-itouchiphone

All five submissions can be found at:

http://developer.appcelerator.com/questions/tag/exc_bad_access

Item (1) above contains example code that recreates the error. We copied this code and created a test project. The code basically has a base window and then opens a second window in another context, pauses for one second, closes the window, pauses for one second, then reopens the window. With this code, we are able to reproduce the crash.

We were able to collect a number of crash logs but all exhibited the same signature. We’ve attached one crash log here (1-page .pdf) and can send a 19-page .pdf via email.  The number of iterations varied from as few as 7 to as high as 153. The lower number iteration counts seem to appear after the project has been cleaned, rebuilt and then run in the iPhone Simulator. There are a few exceptions where the test code ran as high as 600 iterations without failing.

Reducing the pause times resulted in fewer iterations needed to cause the crash.  Also, we’re unable to reduce the pause time below 250 ms as the app locks up.

Given that we’ve had to add timers at various points throughout the app in order to get a given control to launch, we’re suspecting that this may to be some sort of timing issue – basically, trying to access a deallocated block of memory or trying to access a block of memory that has not be allocated.

We would welcome help with finding the root cause or an acceptable workaround.

With ideas and suggestions, please contact Anne Giles Clelland, anne@handshake20.com.

Thanks very much.

Who's in FRONT? Jesse Ward
Smart College Visit Debuts Travel Widget