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.

Unexpected NDK crash



The scenario is pretty simple:

  1. application opens socket0 and connects to the registration server
  2. application sends an auth message (1Kb or so)
  3. registration server replies with an ip:port of a data server
  4. application closes socket0
  5. application opens socket1 and connects to the data server
  6. application sends data
  7. TCP stack crashes.

It happened that the app was (erroneously) configured with just 10 network buffers. The connect at step 5 failed with a timeout (errno 60), and a wrapping routine returned INVALID_SOCKET. A caller didn't test the return value, and passed INVALID_SOCKET to send(), which immediately crashed (DFSR 0x0b).

As far as I understand the NDK API (and a TCP spec in general), passing INVALID_SOCKET is OK (it should fail with EBADF, but not crash).

I strongly suspect that the crash is caused by the absence of network buffers (still held by the socket0 maybe?). Could somebody confirm/deny my suspicions?


In case it matters, ti-rtos 2-10-01-38, ndk 2-24-01-18

  • Hi Victor P97,

    Thanks for listing your s/w versions, this does matter.  Could you please also let me know which h/w platform you're using?

    When the app crashes, can you open the ROV tool in CCS and check the Task view?  You'd be looking for a stack overflow.  This is the first and easiest thing to check for when you see a crash like this.

    It could be possible that the crash is due to a lack of buffers, but usually that would just cause Ethernet frames to drop.

    Also, it sounds like you got a register dump output in the console window when it crashed.  You can use that information to back trace where the crash occurred by following the steps of this FAQ.

    Steve