At the end of StartTaskModbusMaster, it only releases the semaphore in the no error case. Releasing the semaphore unconditionally before falling out makes it much less likely to hang. There is still some issue causing this task to hang in a busy environment so I will keep digging.