Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unstable catching #3

Closed
4ntoine opened this issue Mar 6, 2014 · 6 comments
Closed

Unstable catching #3

4ntoine opened this issue Mar 6, 2014 · 6 comments

Comments

@4ntoine
Copy link

4ntoine commented Mar 6, 2014

I can't understand and this can probably be not coffeecatch issue, but it seems to be.

Sometimes crash is not catched and the process just die:

case 1 (catched):

03-06 18:49:47.562: ERROR/CLANG_WRAPPER(4862): going to test crash
03-06 18:49:47.562: WARN/crash_handler(4862): Caught a crash, signum=11
03-06 18:49:47.562: ERROR/webcore(4862): Report WebCore crash to the ErrorReportUtils at:Thu Mar 06 18:49:47 GMT+05:00 2014
03-06 18:49:47.562: ERROR/CLANG_WRAPPER(4862): catch()
03-06 18:49:47.562: ERROR/CLANG_WRAPPER(4862): ** FATAL ERROR in parseTranslationUnit(): signal 11 (Address not mapped to object) at address 0x0 [at libclang_wrapper.so:0x89d0 (Java_name_antonsmirnov_clang_clang_1wrapper_parseTranslationUnit+0x8c)]
03-06 18:49:47.582: INFO/ActivityManager(539): Process name.antonsmirnov.android.app (pid 4862) has died.
03-06 18:49:47.582: WARN/ActivityManager(539): Force removing ActivityRecord{43f2a538 name.antonsmirnov.android.app/.ui.MainActivity}: app died, no saved state

case 2 (died):

03-06 18:51:10.220: ERROR/CLANG_WRAPPER(5120): going to test crash
03-06 18:51:10.230: INFO/CloudTaskManager(1740): [backupApp] pkgName[com.infoshell.recradio]
03-06 18:51:10.230: INFO/CloudTaskManager(1740): [tryBackupOneApp] pkgName[com.physicaloid.app.writer] backup
03-06 18:51:10.230: INFO/CloudTaskManager(1740): [backupApp] pkgName[com.physicaloid.app.writer]
03-06 18:51:10.240: INFO/CloudTaskManager(1740): [tryBackupOneApp] pkgName[com.pdaxrom.cctools.sdlplugin] backup
03-06 18:51:10.240: INFO/CloudTaskManager(1740): [backupApp] pkgName[com.pdaxrom.cctools.sdlplugin]
03-06 18:51:10.240: INFO/CloudTaskManager(1740): [tryBackupOneApp] pkgName[yz.opengl.es11] backup
03-06 18:51:10.240: INFO/CloudTaskManager(1740): [backupApp] pkgName[yz.opengl.es11]
03-06 18:51:10.240: INFO/CloudTaskManager(1740): [tryBackupOneApp] pkgName[slickdevlabs.apps.usbtoserialterm] backup
03-06 18:51:10.240: INFO/CloudTaskManager(1740): [backupApp] pkgName[slickdevlabs.apps.usbtoserialterm]
03-06 18:51:10.250: INFO/CloudTaskManager(1740): [tryBackupOneApp] pkgName[com.example.CoffeeCatchDemo] backup
03-06 18:51:10.250: INFO/CloudTaskManager(1740): [backupApp] pkgName[com.example.CoffeeCatchDemo]
03-06 18:51:10.250: INFO/CloudTaskManager(1740): [tryBackupOneApp] pkgName[jp.ksksue.app.terminal] backup
03-06 18:51:10.250: INFO/CloudTaskManager(1740): [backupApp] pkgName[jp.ksksue.app.terminal]
03-06 18:51:10.250: INFO/ActivityManager(539): Process name.antonsmirnov.android.app (pid 5120) has died.

the code:

COFFEE_TRY() {

        debug("going to test crash\n");
        char *source_filename = NULL; // TODO : UNCOMMENT !!! (JUST FOR TEST) //string_copy(env, jfilename);
        *source_filename = '!';
        debug("no crash happened\n");

        // ...

    } COFFEE_CATCH() {
        debug("catch()");
        const char*const message = coffeecatch_get_message();
        debug("** FATAL ERROR in parseTranslationUnit(): %s\n", message);

        // cancel alarm (otherwise the process die in few seconds)
        coffeecatch_cancel_pending_alarm();

        // throw exception
        coffeecatch_throw_exception(env);
    } COFFEE_END();
@4ntoine
Copy link
Author

4ntoine commented Mar 6, 2014

case 3 (died):

03-06 19:01:03.076: ERROR/CLANG_WRAPPER(2908): going to test crash
03-06 19:01:03.116: INFO/ActivityManager(537): Process name.antonsmirnov.android.app (pid 2908) has died.
03-06 19:01:03.126: WARN/ActivityManager(537): Force removing ActivityRecord{43285098 name.antonsmirnov.android.app/.ui.MainActivity}: app died, no saved state

Not sure why it died as i have demo app and it works perfect (catches exception every time). Now i'm trying with production code and it does not catch exceptions. i've checked everything few times and i'm in stuck. Any thoughts?

@xroche
Copy link
Owner

xroche commented Mar 6, 2014

I don't see any crash in the logs - this is most probably unrelated to coffeecatch. Do you have a simple reproducible test case ?

(Note that crashes are not exceptions, but signals - coffeecatch won't catch any C++ exceptions, if this is what you are looking for.)

@4ntoine
Copy link
Author

4ntoine commented Mar 7, 2014

according to the code above (writing to NULL pointer) signal 11 is sent and it's not catched by coffeecatch (cases 2,3) but sometimes it is catched (case 1). i've created demo app (issue 2) and coffeetaches does catch such errors all the time. i expect coffeecatch to catch it and throw java exception in this app too but the app just dies. if i comment the code above it's working good. so should coffeecatch handle such errors?

@4ntoine
Copy link
Author

4ntoine commented Mar 7, 2014

i've moved native lib from my example project (https://github.com/4ntoine/CoffeeCatchDemo) to production project and it does not catch signals at all. It must be environment or other libs affecting this or smth. Any thoughts? I can't provide production code source but I can check any code or your thoughts as i like your lib and i want to make it working in production code.

Please contact me using email dev [at] antonsmirnov [dot] name or skype anton.smirnov.skype or please leave your contact (email, skype).

@xroche
Copy link
Owner

xroche commented Mar 7, 2014

Sorry, but unfortunately I don't have the time for that. If you are using other native libraries, first run your code without using them (without loading them at all, to prevent any static initializers)

@xroche xroche closed this as completed Mar 7, 2014
@4ntoine
Copy link
Author

4ntoine commented Mar 8, 2014

Ok, no problem. But i don't think the issue is resolved just because you don't time to resolve it.
I'd not recommend to use the lib in production code for now unfortunately..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants