Skip to content

Commit a0f647e

Browse files
committed
Merge pull request #2365 from pguyot/w29/receive-lost-wake
esp32: return from receive_events once drained These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
2 parents fce094e + 617178c commit a0f647e

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8383
- Fixed ESP32 socket driver holding the global socket-list lock across blocking TCP connects, leaking the port on connect failure, losing concurrent `accept` waiters, leaking `netbuf` on receive error paths, and a recycled-`netconn` race between socket close and the event handler
8484
- Fixed generic_unix TCP server sockets performing an abortive close that could truncate replies awaiting ack
8585
- Fixed a JIT crash (`EXC_BAD_ACCESS`/SIGBUS) on Apple Silicon
86+
- Fixed the ESP32 event poller re-blocking after running a listener, which could delay a process
87+
readied by a driver (e.g. an active-mode socket message) until the next event or timer tick
8688

8789
## [0.7.0-alpha.1] - 2026-04-06
8890

src/platforms/esp32/components/avm_sys/sys.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ static void receive_events(GlobalContext *glb, TickType_t wait_ticks)
132132
void *sender = NULL;
133133
QueueSetMemberHandle_t event_source;
134134
while ((event_source = xQueueSelectFromSet(event_set, wait_ticks))) {
135+
// Drain without re-blocking after the first event, then return so the
136+
// scheduler loop can run any process a listener just made ready
137+
wait_ticks = 0;
135138
// Listener used shared event_queue.
136139
if (event_source == event_queue) {
137140
if (UNLIKELY(xQueueReceive(event_queue, &sender, 0) == pdFALSE)) {

0 commit comments

Comments
 (0)