mirror of
https://github.com/eledio-devices/thirdparty-AsyncTCPSock.git
synced 2025-10-30 16:15:40 +01:00
Prevent deadlock between DNS resolution callback and LWIP call
Stop taking the _asyncsock_mutex when DNS resolution has finished. Doing so causes a deadlock because the callback runs in the LWIP thread and therefore will wait forever on the _asyncsock_mutex lock, but the task holding the lock can in turn attempt a LWIP call, which requires the LWIP thread to be runnable.
This commit is contained in:
@@ -593,9 +593,9 @@ void _tcpsock_dns_found(const char * name, struct ip_addr * ipaddr, void * arg)
|
||||
}
|
||||
|
||||
// Updating state visible to asyncTcpSock task
|
||||
xSemaphoreTakeRecursive(_asyncsock_mutex, (TickType_t)portMAX_DELAY);
|
||||
// MUST NOT take _asyncsock_mutex lock, risks a deadlock if task holding lock
|
||||
// attempts a LWIP network call.
|
||||
c->_isdnsfinished = true;
|
||||
xSemaphoreGiveRecursive(_asyncsock_mutex);
|
||||
|
||||
// TODO: actually use name
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user