System Deadlock
Posted: Fri Aug 04, 2017 10:13 am
Hi All
got an issue by where the system gets into a deadlock state.
In the system there are numerous threads doing different things.
One of the threads(SEND) on completion of sending some data posts a message back(MSG#1) to the main system event thread. It does this using
chMBPost( &mbox, ( msg_t )msg, TIME_INFINITE );
Other threads also post messages to the main system event thread too. The main system event thread can block for small amount of time when processing certain events, but my understanding is this should not effect the mailbox accepting new messages, they will just be queued. The only time a posting thread will be blocked is if the mailbox is full, which should never happen as I've got them set quite large.
What i'm seeing is Thread(SEND) gets locked on the chMBPost, now if i change the timeout to TIME_IMMEDIATE, then the system does not lock, but that message is not posted to the main system event thread, and thus i loose the MSG#1.
So how can a find out what the route cause of the issue is ?
worth noting the scheduler and other threads are still running, it just seems there is dealock between sending thread and main system event thread.
got an issue by where the system gets into a deadlock state.
In the system there are numerous threads doing different things.
One of the threads(SEND) on completion of sending some data posts a message back(MSG#1) to the main system event thread. It does this using
chMBPost( &mbox, ( msg_t )msg, TIME_INFINITE );
Other threads also post messages to the main system event thread too. The main system event thread can block for small amount of time when processing certain events, but my understanding is this should not effect the mailbox accepting new messages, they will just be queued. The only time a posting thread will be blocked is if the mailbox is full, which should never happen as I've got them set quite large.
What i'm seeing is Thread(SEND) gets locked on the chMBPost, now if i change the timeout to TIME_IMMEDIATE, then the system does not lock, but that message is not posted to the main system event thread, and thus i loose the MSG#1.
So how can a find out what the route cause of the issue is ?
worth noting the scheduler and other threads are still running, it just seems there is dealock between sending thread and main system event thread.