How to interpret the thread state in Call Stack in VS Code?

Greetings!

We are trying to troubleshoot occasional hangup issue.  We run the app in debug mode.  When it hangs up, we hit pause and got the followings in the Call Stack window.

The question is, how to interpret the states of the various threads?

The main thread

  • consists of a loop which reads from a FIFO (fed with scanned advertisements from Bluetooth threads), and write those data to UART
  • k_sleep(K_MSEC(20)) at the end of the loop
  • got stuck from time to time at k_sleep(K_MSEC(20)) (as seen by expanding main in the call stack)
  • usually got stuck for 8-9 minutes and then continue to run again

In the call stack, does PENDING mean the thread is ready to execute and is waiting for the processor to be available? 

If so, in the above screenshot, should sysworkq be the thread next in line as it has the highest priority?  Once it finished, the next highest priority thread, BT RX, will run, and so on.  Eventually main will be served.  If my interpretation is correct, then what could be the reason sysworkq is stuck, and how can we troubleshoot this type of problems?

Thank you

Parents Reply Children
  • Hmm, I would think that the MPSL thread would be the next to run, however I don't have too much expertise at this area so I'm not sure why it gets stuck at k_sleep for 8-9 minutes. Would you be able to upload a minimal reproducible sample, then I could try to reproduce it on my side and get a better overview and ask some experts internally what the cause might be.

    Best regards,

    Simon

Related