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: PBMQ_enq() crashes when lot of send() is called in a loop.

Other Parts Discussed in Thread: OMAPL138, EK-TM4C1294XL

I have run into another NDK problem. It seems that if we are calling send() in a very tight loop, the NDK will crash in the PBMQ_enq() function.

The Pq->pTail->pNext pointer is NULL.

I have tracked this down (and think) it happens when PBMQ_free list runs out of buffers. I've put some code in the PBMQ_deq () function to break if the

PBMQ_free.pHead and PBMQ_free.pTail is to be set to NULL. The PBMQ_free.Count is in this case set to "1" (Last free item ?).

I attach some screendumps of memory views and stack traces.

I hope this can make it easier for you to understand the problem.

If I make a Task_sleep(1) between the send() calls, this never happens.

See attached file.2626.PBMQ problems.zip

BR:

Per-Anders

  • What processor and which Processor SDK is this?
  • Hi!

    Sorry, this was transfered from another thread (e2e.ti.com/.../2002419

    We are using the AM571x/am572x, and are currently using the CCS6.1.3, pdk 1_0_4, and ndk 2.25.00.09. (the latest components from TI)

    I have been debugging alot of issues with the ndk/emac/cpsw components and this is what I found late this week.

    Garret Ding asked me to create a new thread.

    BR:

    Per-Anders
  • Thanks. He has been notified and will respond here.
  • Per-Anders,

    I haven't seen the PBMQ_enq crash issue yet with your ftp server code:

    int32_t ftp_filerout_read(io_handler_t *ioh, char *path)
    {
        uint32_t i;
        volatile uint32_t j;

        for (i=0; i<60000;i++)
        {
            send(ioh->data_socket, ioh->DataBuf, DATA_BUFFER_SIZE, 0);
            //Task_yield();
        }

        return CSL_SOK;
    }

    where DATA_BUFFER_SIZE is 1536 bytes. And as you can see, I commented out Task_yield() in the for loop.

    From your snapshot, it seems you got the crash with other project? Also, I recommend you work with the NDK version 2_24_03_35 that comes with Processor SDK package.

    Regards,
    Garrett

  • Hi!

    No with the FTP appl I havn't seen this.

    The code that generates this error is a LUA script that produces small messages that is sent out via the TCP (send()).

    Lua script:

    for i=1,100000000,1 do print (i .. " --  " .. os.date()) end

    This will send out the followig on the telnet port, via the send(). 

    1 -- 2016-10-19 10.10.10

    2 -- 2016-10-19 10.10.10

    3 -- 2016-10-19 10.10.10

    etc.

    /**
     * telnet_lua_tcpip_write
     */
    static int32_t telnet_lua_tcpip_write (io_handler_t *ioh, void *buf, int32_t len)
    {
    	return send (ioh->stream, buf, len == 0 ? strlen((char *)buf) : len, 0);
    }
    
    
    

    If you change the code in the ftp server to just sen out "small" packages rapidly, I'm sure this will trigg the problem.

    I will do a test myself today.

    BR:

  • Hi again.

    I Will test with the "NDK 2_24_03_35".Why isn't the latest NDK used? are the any known issus with that one?

    BR:
  • The known issues are listed in the NDK release note page (software-dl.ti.com/.../ndk_2_24_03_35_release_notes.html), but I don't see anything is obviously related to the PDMQ_enq() crash you observed. The reason to use the NDK from Processor SDK is NIMU as a NDK tranport from Processor SDK/PDK package is thoroughly tested with the NDK release from Processor SDK for AM57x when it's released. The latest NDK release is "validated using the following hardware platforms: EVM OMAPL138 (ARM9 and C674), EK-TM4C1294XL" 
    as shown the release note page.

    Will test the ftp server with small size frames.

    Regards, Garrett