Skip to content

fix: rate-limit CSI sends and add ENOMEM backoff to prevent crash#132

Merged
ruvnet merged 1 commit into
mainfrom
fix/csi-sendto-enomem-crash
Mar 3, 2026
Merged

fix: rate-limit CSI sends and add ENOMEM backoff to prevent crash#132
ruvnet merged 1 commit into
mainfrom
fix/csi-sendto-enomem-crash

Conversation

@ruvnet

@ruvnet ruvnet commented Mar 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Rate-limit CSI sends to 50 Hz (20ms interval) in csi_collector.c — promiscuous mode fires 100-500+ callbacks/sec but the sensing pipeline only needs 20-50 Hz
  • ENOMEM backoff in stream_sender.c — when sendto fails with errno 12 (ENOMEM), suppress further sends for 100ms to let lwIP reclaim packet buffers, then resume automatically

This prevents the cascade of failed sendto calls that exhausts the lwIP pbuf pool and crashes the device with a LoadProhibited guru meditation.

Closes #127

Test plan

  • Build firmware: docker run --rm -v $(pwd)/firmware/esp32-csi-node:/project -w /project espressif/idf:v5.2 bash -c "idf.py set-target esp32s3 && idf.py build"
  • Flash to ESP32-S3 and run on a busy WiFi network
  • Verify no errno 12 crash — logs should show rate-limited sends at ~50 Hz
  • If ENOMEM occurs, verify 100ms backoff + automatic resume in serial output

🤖 Generated with claude-flow

The CSI callback fires for every WiFi frame in promiscuous mode
(100-500+ fps). Each call invoked sendto() synchronously, exhausting
lwIP packet buffers (errno 12 = ENOMEM). The rapid-fire failures
cascaded into a LoadProhibited guru meditation crash.

Two fixes:

1. csi_collector.c: Rate-limit UDP sends to 50 Hz (20ms interval).
   CSI frames arriving between sends are dropped — the sensing
   pipeline only needs 20-50 Hz.

2. stream_sender.c: When sendto fails with ENOMEM, suppress further
   sends for 100ms to let lwIP reclaim buffers. Logs the backoff
   event and resumes automatically.

Closes #127

Co-Authored-By: claude-flow <ruv@ruv.net>
@ruvnet ruvnet merged commit ce17169 into main Mar 3, 2026
0 of 2 checks passed
@ruvnet ruvnet mentioned this pull request Mar 3, 2026
GarrettKrebs pushed a commit to GarrettKrebs/RuView that referenced this pull request Mar 9, 2026
…vnet#132)

The CSI callback fires for every WiFi frame in promiscuous mode
(100-500+ fps). Each call invoked sendto() synchronously, exhausting
lwIP packet buffers (errno 12 = ENOMEM). The rapid-fire failures
cascaded into a LoadProhibited guru meditation crash.

Two fixes:

1. csi_collector.c: Rate-limit UDP sends to 50 Hz (20ms interval).
   CSI frames arriving between sends are dropped — the sensing
   pipeline only needs 20-50 Hz.

2. stream_sender.c: When sendto fails with ENOMEM, suppress further
   sends for 100ms to let lwIP reclaim buffers. Logs the backoff
   event and resumes automatically.

Closes ruvnet#127
rotprods pushed a commit to rotprods/RuView that referenced this pull request Apr 19, 2026
…vnet#132)

The CSI callback fires for every WiFi frame in promiscuous mode
(100-500+ fps). Each call invoked sendto() synchronously, exhausting
lwIP packet buffers (errno 12 = ENOMEM). The rapid-fire failures
cascaded into a LoadProhibited guru meditation crash.

Two fixes:

1. csi_collector.c: Rate-limit UDP sends to 50 Hz (20ms interval).
   CSI frames arriving between sends are dropped — the sensing
   pipeline only needs 20-50 Hz.

2. stream_sender.c: When sendto fails with ENOMEM, suppress further
   sends for 100ms to let lwIP reclaim buffers. Logs the backoff
   event and resumes automatically.

Closes ruvnet#127
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sendto failed: errno 12

1 participant