At this stage, I forcefully close the connection from the Linux side.
This will cause err_tcp() to be called from within the context of LWIP
thread (tcpip_thread()). err_tcp() first attempts to post data to the
connection's mbox with:
if (conn->recvmbox != SYS_MBOX_NULL) {
/* Register event with callback */
API_EVENT(conn, NETCONN_EVT_RCVPLUS, 0);
sys_mbox_post(conn->recvmbox, NULL);
}
And afterwards it may or may not signal the completion semaphore. Now,
sys_mbox_post does not return until the message is posted to the
queue. Assuming the queue is full, it will not return until a message
is read from the queue and space is made available.
This second problem seems a bit more straightforward. We need some way
to postpone the addition to the recvmbox if the mbox is full, or change
the mbox so that NULL can always be posted. I prefer the latter.
Either way, could you file a bug for this part of the problem?