Android Question Native crash at /system/lib/libcutils.so

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

I have been getting some bug reports for one of my apps lately and can't work out where this bug is happening.

Most (if not all) are from Samsung devices (Galaxy S4 (ks01lte), Galaxy Note II (t03g), and they haven't left any user comments on how the bug happens so I only have the following report to go by.

Just wondering if anyone knows what causes this bug:

Native crash at /system/lib/libcutils.so
in /system/lib/libcutils.so (android_atomic_dec+12), /system/lib/libutils.so (android::RefBase::decStrong(void const*) const+10)

Full report is attached.

I haven't updated the app in a little since it hasn't had any problems with it, but now since it's starting to get bugs I need to start looking into it and finding out what is causing the issues.

It was last updated on August 2013 (yes I know it's been a while) so it would of been compiled with a older version of B4A. (would of been complied with the latest version of B4A that was available in August 2013)

Has something in B4A been changed since to fix some issues etc that could be causing this bug and now I need to re-upload the APK with a newer version of B4A? Or is there something else wrong in my code that could be causing this bug?

I am planning to re-write the app again soon from the ground up as I want to clean up a lot of the code so I didn't want to spend to much time on fixing this issue, but if it was something simple to fix for now to stop these bug reports from coming through.
 

Attachments

  • report.txt
    4.1 KB · Views: 234

Erel

B4X founder
Staff member
Licensed User
Longtime User
There was an issue related to the interception of the back key (Activity_KeyPress). Are you showing a modal dialog in that case?

Specifically the issue with back key was fixed. However if you catch a different key and show a modal dialog or call DoEvents then it can cause problems. The solution is to use CallSubDelayed to move out of the event sub.
 
Upvote 0

aaronk

Well-Known Member
Licensed User
Longtime User
Oh.
I do remember reading something about this on the forum. Totally forgot about it.

I am making it when you press the back key on the device to display a message that says are you sure you want to close the app.

I am guessing I should re-compile it again using the latest B4A and it should be ok, or should I detect if the back button was pressed from the Activity_KeyPress sub then use CallSubDelayed to trigger another sub to display the message rather then displaying the message from the Activity_KeyPress sub?
 
Upvote 0

aaronk

Well-Known Member
Licensed User
Longtime User
Easy way is just use the latest version and you should be fine. I am now using 3.82 and haven't had this bug since. (touch wood)
 
Upvote 0

vasper

Member
Licensed User
Longtime User
Hi. I am using B4A 5.5 and this error seems to be back. I have a Galaxy Note IV that shows the error. So does a friend's Galaxy Note II. Other phones, like an LG Optimus 4X seem to be unaffected. It also appears to have to do with a key release, however when the error appears, no keys have been pressed. No dialogs are used on Activity_KeyPress events and the only relevant info I can think of is this:

B4X:
sub barCodeResult(result As String)
  '..... do some work with barcode result....


  Dim asb As CallSubUtils
  asb.Initialize
  asb.CallSubDelayedPlus(Me,"finishAfterRead",6000)


end sub


Sub finishAfterRead
    If Activity.IsInitialized Then
        Activity.Finish
    End If
End Sub



B4X:
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/t03gxx/t03g:4.4.2/KOT49H/N7100XXUFNL1:user/release-keys'
Revision: '11'
pid: 4970, tid: 4970, name: .apps.loyalties  >>> beconnected.apps.loyalties <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr fffffff4
    r0 00000000  r1 5b94eefc  r2 419718a8  r3 42fe0000
    r4 5b1bb320  r5 5b94eef0  r6 00000000  r7 00000031
    r8 5b1bb368  r9 00000000  sl 400af801  fp 400af70a
    ip 00000001  sp bebfd228  lr 41ac13f5  pc 400ad7d0  cpsr 200d0030
    d0  0000000080000000  d1  0000000042480000
    d2  0000000000000000  d3  0000000000000000
    d4  000000e53f35b5b6  d5  441b000042000000
    d6  4333000000000000  d7  0000000080000000
    d8  0000000000000000  d9  0000000000000000
    d10 0000000000000000  d11 0000000000000000
    d12 0000000000000000  d13 0000000000000000
    d14 0000000000000000  d15 0000000000000000
    d16 0000399b748efc1e  d17 401e0358a0000000
    d18 3f9745d1745d1746  d19 401e1745e0000000
    d20 401e1745e0000000  d21 4028000000000000
    d22 3fe40f83eaaaaaab  d23 4024000000000000
    d24 4000000000000000  d25 547d42aea2879f2e
    d26 b96377ce858a5d48  d27 b96377ce858a5d48
    d28 fffffffffffffffe  d29 fffffffffffffffe
    d30 0000000000000000  d31 0000000000000000
    scr 60000013

backtrace:
    #00  pc 000107d0  /system/lib/libutils.so (android::Looper::pollInner(int)+499)
    #01  pc 00010869  /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
    #02  pc 00070a5d  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
    #03  pc 0001ea4c  /system/lib/libdvm.so (dvmPlatformInvoke+112)
    #04  pc 0004f0a3  /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
    #05  pc 00027e60  /system/lib/libdvm.so
    #06  pc 0002ee44  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
    #07  pc 0002c4dc  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
    #08  pc 000618cd  /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+392)
    #09  pc 00069907  /system/lib/libdvm.so
    #10  pc 00027e60  /system/lib/libdvm.so
    #11  pc 0002ee44  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
    #12  pc 0002c4dc  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
    #13  pc 000615e9  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
    #14  pc 0004abd3  /system/lib/libdvm.so
    #15  pc 000529bf  /system/lib/libandroid_runtime.so
    #16  pc 00053f53  /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+354)
    #17  pc 0000105b  /system/bin/app_process
    #18  pc 0000e473  /system/lib/libc.so (__libc_init+50)
    #19  pc 00000d7c  /system/bin/app_process

code around pc:
    400ad7b0 68024639 c008f8d2 47e0682a 4620b918 
    400ad7c0 f7ff4639 68ebfe95 010cf105 6818b13b 
    400ad7d0 7c0cf850 f7fc19d8 f8c5fccc f06f900c 
    400ad7e0 36010701 428e6d21 4638d3d7 e8bdb049 
    400ad7f0 bf008ff0 00002098 00002125 00002175 
    400ad800 0000207c 0000207a 00002114 43f8e92d 
    400ad810 46884604 461e4615 20009f08 0914f04f 
    400ad820 6ce3e011 65e11c51 3202fb09 2b006893 
    400ad830 6850db09 69126811 6028b105 6031b106 
    400ad840 603ab1b7 6de2e014 429a6d23 b148d3e9 
    400ad850 2100b10d b10e6029 60322200 2300b13f 
    400ad860 e004603b 46414620 feb8f7ff 4603e7eb 
    400ad870 e8bd4618 000083f8 47f3e92d 46071e0e 
    400ad880 46994690 a028f8dd 4642dc0a a000f8cd 
    400ad890 46314638 f7ff464b 1c82ffb9 e01dd0f5 
    400ad8a0 f7fe2001 4b0ef90d 460d4604 4506fbc3 

code around lr:
    41ac13d4 bf00bd3e 000708b2 fffffe9c 000523f6 
    41ac13e4 00056c2f 2107b510 68004604 fc5ff00a 
    41ac13f4 bd104620 4603b537 460c4d12 46194668 
    41ac1404 f7ff447d b1c4ffc7 582d480f 7058f505 
    41ac1414 f7d39001 f505ee26 21007052 f7de4622 
    41ac1424 b938edc6 20054909 46234a09 447a4479 
    41ac1434 edc2f7d3 f7ffa801 4668ff21 ffd2f7ff 
    41ac1444 bf00bd3e 00070850 fffffea0 00052384 
    41ac1454 00056c00 b5374603 a801460d 4c094619 
    41ac1464 ff98f7ff 447c4808 a8015821 2a00688a 
    41ac1474 f04fbf0c 240034ff f7ff602a 4620ffb3 
    41ac1484 bf00bd3e 000707ea fffffe9c 4601b513 
    41ac1494 a8014614 ff7ef7ff f7d34620 a801ed7c 
    41ac14a4 ffa0f7ff b573bd1c 46164601 e9dda801 
    41ac14b4 f7ff4506 68f3ff6f d5060659 46294620 
    41ac14c4 0210f106 eef4f7dd e9c6e001 a8014504
 
Upvote 0

vasper

Member
Licensed User
Longtime User
Erel, thanks for the quick reply. The problem is it is a rather large, commercial project, and the interface language is in Greek. We will be presenting it at an Expo this week, so I don't have time to cut it down and send you a version you can compile and reproduce the problem. I plan to do so, right after the expo, next week.
 
Upvote 0

JordiCP

Expert
Licensed User
Longtime User
Perhaps I'm wrong, but I think that the the "release-keys" that appears at the logs has nothing to do with a key being released.

As a bug-hunter (because I am an expert bug-generator) I would recommend to fill the "suspicious" parts of the code with logs. Perhaps the library you are using needs some kind of "closing" before finishing the activity?
 
Upvote 0
Top