This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

NDK application crashes

Hi,

We have successfully setup NDK stack on am335x platform. The NDK tests have passed successfully(except the flood ping issue which has been acknowledged). Now we are trying to bring in our application on top of NDK. It's an Industrial protocol Ethernet/IP which requires a robust network. While doing a few tests on the stack, we found that one of these tests trigger the issue we saw with flood ping. Currently waiting for inputs from the NDK team on this(See here : http://e2e.ti.com/support/embedded/bios/f/355/p/238538/856030.aspx#856030 and here http://e2e.ti.com/support/embedded/bios/f/355/p/223029/855984.aspx#855984)

However, in our tests, the NDK randomly shuts down with an error of mmBulkAlloc(). Here is what we see on CCS console.

[CortxA8] Phy: 30, NegMode 01E1, NWAYadvertise 01E1, NWAYREadvertise 45E1
[CortxA8] Negotiated connection: FullDuplex 100 Mbs
[CortxA8] 01985.519 mmBulkAlloc(): could not allocate memory.
[CortxA8] 01985.520 out of memory: handle=0xa, size=2148253152
[CortxA8] Network Removed: If-1:192.168.0.2
[CortxA8]
[CortxA8] 56:48 ( 87%) 16:96 ( 50%) 1:128 ( 4%) 52:256 ( 86%)
[CortxA8] 2:512 ( 33%) 0:1536 0:3072
[CortxA8] (27648/49152 mmAlloc: 170067796/0/170067713, mmBulk: 47/1/38)
[CortxA8]
[CortxA8] 1 blocks alloced in 512 byte page
[CortxA8] (0000)
[CortxA8] 41 blocks alloced in 48 byte page
[CortxA8] (8004C8B4) (296ABC00) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000B)
[CortxA8] (000B) (000B) (000B) (000B) (000B) (0003) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000B) (000
[CortxA8] B) (000B) (000B)
[CortxA8] 1 blocks alloced in 96 byte page
[CortxA8] (1008)
[CortxA8] 3 blocks alloced in 256 byte page
[CortxA8] (000A) (000A) (000A)
[CortxA8] 12 blocks alloced in 256 byte page
[CortxA8] (0000) (000A) (8004F7C4) (000A) (8004F9C4) (000A) (8004FBC4) (000A) (8004FDC4) (000A) (8004FFC4) (000A)
[CortxA8] 12 blocks alloced in 256 byte page
[CortxA8] (800501C4) (000A) (800503C4) (000A) (800505C4) (000A) (800507C4) (000A) (800509C4) (000A) (80050BC4) (000A)
[CortxA8] 12 blocks alloced in 256 byte page
[CortxA8] (80050DC4) (000A) (80050FC4) (000A) (800511C4) (000A) (800513C4) (000A) (800515C4) (000A) (800517C4) (000A)
[CortxA8] 1 blocks alloced in 256 byte page
[CortxA8] (800519C4)
[CortxA8]
[CortxA8] 01985.548 mmAlloc: PIT Used Sync
[CortxA8] 01985.549 fdOpenSession: OOM
[CortxA8] 01985.550 mmAlloc: PIT Used Sync
[CortxA8] 01985.551 fdOpenSession: OOM

This happens often, but I'm afraid I'm not sure on what scenario it does. Can you provide some inputs on how to go about this issue? Or what debug information I can get from these logs?

Thanks,
Vinesh 

  • Vinesh,

    Looks like something is getting corrupted because the allocation failure says:

    [CortxA8] 01985.520 out of memory: handle=0xa, size=2148253152

    That size is bogus and looks suspiciously like a pointer value (0x800BBDE0). I noticed in another thread that you have had stack overflows. Can you check to see if that is the case here, too? You could also set a breakpoint in the mmBulkAlloc() function where the error is detected and see who is calling at that point.

    Mark

  • Mark,

    Thanks for the response. However, I'm not sure how to debug the NDK stack. I checked this page http://processors.wiki.ti.com/index.php/Rebuilding_the_NDK_Core but it seems it is meant for NDK 2.20. I'm using NDK 2.21.01.38 for which I could only find http://processors.wiki.ti.com/index.php/Rebuilding_The_NDK_Core_Using_Gmake(this mentions only about rebuilding, not debugging). Is there some procedure to set this up?

    Thanks,

    Vinesh 

  • Vinesh,

    Did you check stack usage?

    The wiki article applies to the version you are using, as well. There's nothing special to debugging the stack - it's just C code. Set a breakpoint on mmBulkAlloc error branch and then let your application run.

    Mark

  • Mark,

    I wasn't aware of how to setup NDK for step-by-step debugging. On digging in the forums, I found that the ndk.bld had to be modified. I think that should have been mentioned in http://processors.wiki.ti.com/index.php/Rebuilding_The_NDK_Core_Using_Gmake . 

    After setting up NDK for debugging, I noticed that the Heap memory was not sufficient when this error fired. On further debugging I found that we were missing fdClose() while closing a socket. That solved the issue. Thanks a lot for the support.

    Vinesh

  • Vinesh,

    Glad you found the problem. I guess you mean that you had to change the ndk.bld file to enable debug info during the recompile? Specifically, the lines:

    /* Uncomment the following lines to build libraries for debug mode: */
    // c6xOpts += " -g -o0 ";
    // armOpts += " -g -o0 ";
    // gnuOpts += " -g ";

    If that's what you mean, we can (or you could - it is a wiki) add that to the wiki page. We should also consider a debug profile option from the ndk.mak.

    Mark

  • Mark,

    Yes, that's what I meant. Added the information into Wiki page.

    Vinesh