chMBPostTimeout: chSysHalt unsuspending timeouted reader thread

Discussions and support about ChibiOS/RT, the free embedded RTOS.
eee
Posts: 1
Joined: Fri Dec 20, 2019 9:30 am

chMBPostTimeout: chSysHalt unsuspending timeouted reader thread

Postby eee » Fri Dec 20, 2019 9:41 am

Using Chibios/RT 19.1.2.
One thread is doing

Code: Select all

chMBPostTimeout(&this->m_auxmsg_mbox, (msg_t)msg, TIME_IMMEDIATE);

(n.b: msg is a pointer to a message allocated from a memory pool)

Another thread is blocking on the mailbox:

Code: Select all

auto result = chMBFetchTimeout(&this->m_auxmsg_mbox, (msg_t *) &m, TIME_MS2I(10));


If the timeout occurs before the post, the post causes a chSysHalt via chThdDoDequeueNextI, specifically due to the line

Code: Select all

chDbgAssert(tp->state == CH_STATE_QUEUED, "invalid state");


However, if the timeout is TIME_IMMEDIATE, the crash doesn't occur.

I should also note that even if the timeout is raised above the amount of time the posting thread takes, the message never comes through.

Am I somehow misusing message-boxes entirely? Any idea what's going on?

User avatar
Giovanni
Site Admin
Posts: 12400
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 612 times
Been thanked: 518 times
Contact:

Re: chMBPostTimeout: chSysHalt unsuspending timeouted reader thread

Postby Giovanni » Fri Dec 20, 2019 10:15 am

Hi,

It is not very clear to me, could you check tp->state when the assertion occurs? please also get the stack trace at the assertion point.

Giovanni


Return to “ChibiOS/RT”

Who is online

Users browsing this forum: No registered users and 2 guests