Skip to content

fix(wg_mgr): yield 1 tick per peer in disco_periodic_probes - #49

Merged
fudio101 merged 1 commit into
mainfrom
fix/disco-probe-yield
Aug 18, 2026
Merged

fix(wg_mgr): yield 1 tick per peer in disco_periodic_probes#49
fudio101 merged 1 commit into
mainfrom
fix/disco-probe-yield

Conversation

@fudio101

Copy link
Copy Markdown
Collaborator

What

disco_periodic_probes() iterates every active peer with no yield point in
between. On a large tailnet the full loop can run 50-170ms back-to-back;
since wg_mgr shares core 1 with coord (see CLAUDE.md's task table),
this starves coord (and anything else pinned to core 1) long enough to
trip watchdogs on real hardware. Adds vTaskDelay(1) at the top of each
per-peer iteration — gives other same-core tasks scheduler time without
measurably affecting DISCO cadence (the loop still completes within the same
outer 1s cycle, just with a shorter peak burst length).

Source

Adapted from cplewes/microlink
9f6af750 (not cherry-picked — base has diverged too far). cplewes's
original commit message cites a specific incident (BLE-RPC notify pool
starvation on a long-uptime capture); this fork doesn't have that
downstream's BLE stack, so the comment here is adapted to reference our own
core/task assignment instead.

Related issues

Closes #24

Independent of #47/#48 — touches ml_wg_mgr.c only, branched fresh off
main.

Test plan

idf.py build isn't runnable in this sandbox (no ESP-IDF installed).
Manual check: confirmed vTaskDelay(1) sits inside the per-peer loop body,
at the top of each iteration (matches cplewes's placement — delays before
the first peer too, which is intentional and harmless). Needs hardware
re-test on a tailnet with enough peers to actually observe the starvation
this addresses; a 1-2 peer test tailnet won't exercise it.

On a large tailnet the full DISCO probe loop can run 50-170ms
back-to-back with no yield point, starving other same-core tasks
(wg_mgr shares core 1 with coord) long enough to trip watchdogs on
real hardware. A 1-tick vTaskDelay between peers gives them scheduler
time without measurably affecting DISCO cadence.

Adapted from cplewes/microlink@9f6af750.

Closes #24

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@fudio101
fudio101 force-pushed the fix/disco-probe-yield branch from 489b6bc to 75a47d3 Compare August 18, 2026 16:49
@fudio101
fudio101 merged commit dde0925 into main Aug 18, 2026
13 checks passed
fudio101 added a commit that referenced this pull request Aug 18, 2026
…R_SUPPORTED (#50)

* fix(config_httpd): gate temp-sensor code behind CONFIG_SOC_TEMP_SENSOR_SUPPORTED

esp_driver_tsens was an unconditional REQUIRES and the temp-sensor init/
read/deinit calls were unconditional too, breaking the build on SoC
variants without a temperature sensor. Gate both behind
CONFIG_SOC_TEMP_SENSOR_SUPPORTED; handler_monitor still always returns a
temp_c JSON field (null when unsupported) so the REST API shape is
unchanged.

Cherry-picked from liestrela/microlink@1649d987.

Closes #29

Co-authored-by: Adrian.Nguyen-Qualgo <nguyen.ndt@qualgo.net>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>

* docs: mark FORK_PRS.md rows for issues #24 and #29 done

Row 5 (#24, PR #49) was missed when marking rows done in the prior
batch. Row 10 (#29) is this PR.

Co-authored-by: Adrian.Nguyen-Qualgo <nguyen.ndt@qualgo.net>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>

* fix(build): keep esp_driver_tsens REQUIRES unconditional

Kconfig-gating a REQUIRES entry silently no-ops in this build (documented
a few lines above for esp_driver_uart/esp_driver_gpio, same root cause):
REQUIRES is resolved before Kconfig is available, so
CONFIG_SOC_TEMP_SENSOR_SUPPORTED evaluates false regardless of target and
esp_driver_tsens never gets linked in -- while ml_config_httpd.c's
post-Kconfig #if CONFIG_SOC_TEMP_SENSOR_SUPPORTED is true on esp32s3, so
it tries to include a header from a component that was never required.
CI caught this: "driver/temperature_sensor.h: No such file or
directory" on every v6.0.1 build.

The CONFIG_SOC_TEMP_SENSOR_SUPPORTED check in ml_config_httpd.c already
correctly gates the feature at compile time; only the REQUIRES gating
attempt was wrong.

Co-authored-by: Adrian.Nguyen-Qualgo <nguyen.ndt@qualgo.net>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: liestrela <estrela@riseup.net>
Co-authored-by: Adrian.Nguyen-Qualgo <nguyen.ndt@qualgo.net>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.

Yield per-peer in disco_periodic_probes to avoid starving same-core tasks (mined from cplewes/microlink)

2 participants