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.

TM4C129ENCPDT: ndk 2.24.03.35 on TM4C129ENCPDT http server parallel chrome requests problem

Part Number: TM4C129ENCPDT

Hello,

I'm having a problem with the ndk (version 2.24.03.35) http server on a TIVA TM4C129 microcontroller.

When I use chrome to connect to the webpage hosted on the TIVA, part of the page is not loaded and sometimes page is not displayed at all. Debugging on chrome this, it seems that there is an empty response from the tiva.

Inspecting with wireshark the conversation I have noticed that chrome spawns by default two connections, one of them does not make requests (investigating on the web it seems some kind of speculative socket creation) and this maybe the cause of the problem I think. Firefox does not make two connections and the page loads correctly.

Can anyone confirm this behaviour? Has anyone any advice to overcome this problem?

Thank you very much

Matteo

  • Hi Matteo,

      I'm not too sure what is causing the problem. It is possible that the heap is too small or maybe some stack memory problem.  Can you increase the heap size to 22528 and see if it helps? See below.  There are going to be a socket for each connected client. For each socket created, 4096 bytes by default (2048 bytes each for both a Rx and Tx buffer) is needed if you use the default NDK settings.  

    Please also refer to this link about NDK memory management. https://e2e.ti.com/support/processors-group/processors/f/processors-forum/947313/faq-how-is-memory-managed-in-the-ndk

    I also notice your ndk version is a bit old. Can you try tirtos_tivac_2_16_00_08 which has ndk_2_25_00_09? Does it make a difference?

  • Hello Charles,

    Thank you very much for the advices. I increased the heap size and also NDK stack size for every thread priority but it seems not to be the cause of the problem. For the ndk version I will upgrade it and give feedback as soon as possible.

    Thank you

    Matteo

  • Hello Charles,

    I have some news about the problem. I tried with the ndk ndk_2_25_00_09 as you suggested but the problem still persists.

    What I see inspecting the wireshark log is that for parallel requests to port 80 at the second request the TIVA sets FIN flag so it get closed. I am pretty sure that the backlog size for the socket is 16 (I increased it). Any advice?

    Thank you

    Matteo

  • Hi Matteo,

      I think the FIN flag is sent for connection termination when there is no more data from the sender so it can free the reserved resources. I'm not an expert on NDK but I wonder if you can set socket option with SO_KEEPALIVE flag so the socket does not timeout.

  • Hello Charles,

    At the end it was an heap memory problem as you suggested but related to NDK Memory Manager Buffers. Increasing the number of pages solved the problem:

    Thank you for the support!

    Best Regards,

    Matteo