How to track down uncatchable crashes

in a quite complex WebApp (Mac standalone) I’ve seen some crashes that were not caught by any exception handler. Happily I was able to find a way to relibly reproduce them, even running in the debugger. The symptom is that the App just quits. In the debugger log I see the lines “Process Completed. Ended” In the Console I find OSX crash logs with different exceptions:

[code]Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000005a8ba855

VM Regions Near 0x5a8ba855:
MALLOC_TINY 000000000c900000-000000000cc00000 [ 3072K] rw-/rwx SM=PRV
__TEXT 000000008fef5000-000000008ff28000 [ 204K] r-x/rwx SM=COW /usr/lib/dyld

Exception Codes: KERN_INVALID_ADDRESS at 0x00000000e0191290

VM Regions Near 0xe0191290:
CG shared images 00000000c7eb2000-00000000c7eba000 [ 32K] r–/r-- SM=SHM
Submap 00000000ffff0000-00000000ffff1000 [ 4K] r–/r-- SM=PRV process-only VM sub map

Exception Codes: KERN_PROTECTION_FAILURE at 0x000000000161091e

VM Regions Near 0x161091e:
__LINKEDIT 00000000014da000-00000000015c2000 [ 928K] r–/rwx SM=COW /Users/USER/Documents//.debug
–> __TEXT 00000000015c2000-000000000176f000 [ 1716K] r-x/rwx SM=COW /Users/USER/Documents//.dylib
__DATA 000000000176f000-0000000001779000 [ 40K] rw-/rwx SM=ZER /Users/USER/Documents//.dylib

Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000038

VM Regions Near 0x38:
–> __PAGEZERO 0000000000000000-0000000000001000 [ 4K] —/--- SM=NUL /Users/USER/Documents//.debug
__TEXT 0000000000001000-0000000001482000 [ 20.5M] r-x/rwx SM=COW /Users/USER/Documents//.debug

occasionally, there is also a message in the debugger log saying solumserver.debug(30510,0xb0093000) malloc: *** error for object 0xc9b9020: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug

I tried to strip down that part of the application and added a lot of debug statements. The last thing that seem to happen just before the crash is that I set a variable containing an object (simple class) to nil. I then see the Destructor of that object being executed twice (!) and the App dies, no UnhandledException Handler catches this.

What do you recommend how to further debug the issue? Of course I was not yet able to replicate this within a simple demo app.

I wonder if that’s related to what I recently discovered about Destructors:

Like in our Bugreporter you could catch signals, c++ exceptions or Windows System Exceptions.
We have plugin classes to do this in MBS Plugins.

Does your bugreporter work for web apps, I thought it was only for desktop stuff?

We recently copied large parts in a web app.
It’s not designed for web in first place, but you can of course reuse some classes there.

The OS X crash reporter says which thread crashed. Go down to the specific thread, and read downwards until in the second column you find your app name. Then you know the last line of code in your app which started executing before the app crash. You can then set a break point directly before that line and check all values in the debugger to be valid. Usually you’ll find something being invalid.

[quote=82559:@Christian Schmitz]We recently copied large parts in a web app.
It’s not designed for web in first place, but you can of course reuse some classes there.[/quote]

I am really interested in using your BugReporter in my web app. Is it possible to add the plugin to the web app and tell it not to use any UI and force it to send email of errors when they occur? The following line in the manual makes me think that it wont work in a web app “We try to show a bug reporter dialog before that and terminate the application after the dialog is done.”

Also we dont use PHP so is it possible to send emails without PHP?

The plugin would allow you to catch exceptions and signal. But your app is possible in a bad state. So you can log the bug in a log file and check that file after the app was relaunched. Some bugs simply can’t be caught well.
If you have a license for our plugins, you can simply try the classes.

I am probably about to buy your plugin to test out but how would you recommend using it in different setups e.g. Debug and Production as in Debug I obviously would like to see the errors but in Production I want the errors to be logged and an email sent to me but cannot see from the docs how this might be achieved or if their is a better way. I guess what would be nice is if in Debug mode you could have a Trace app that you run on the desktop where error information from the web app gets output to but in live it would do the send email part.

Well, in the Bugreporter Kit we try to catch various Xojo, C++, System Exceptions and Signals. Than we show a bug reporter window where you can type comment and send it. The app will then normally quit. Normally we send an email over our server script, but this can be changed to write in a database.

For a web app, we can’t normally work like this. We can only try to log to database or text file and than handle that on the next launch of web app.

I am getting the feeling that maybe bugreporter is not yet ready to use in a web project or am I wrong? If not then do you have plans to make a web friendly version as I really do want to purchase and use it as it would help a lot in tracking down errors when the project is out in the wild.

if you like, you can get a copy and we work on a web project.
I could simply start and add something there.

For Web Starter Kit we already have code there to log exceptions.

Which would you suggest I buy? I have been looking at the Web Starter Kit. Would you plan to expand the Web Starter Kit to add the features of the BugReporter or would you plan to expand the BugReporter kit more for the web? I just want to make sure I buy the right one.