Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bypass watchdog for long dns resolution #3

Closed
droscy opened this issue May 28, 2023 · 6 comments
Closed

Bypass watchdog for long dns resolution #3

droscy opened this issue May 28, 2023 · 6 comments

Comments

@droscy
Copy link
Owner

droscy commented May 28, 2023

The DNS resolution that happens in esp_wireguard_peer_init() can take long enough on some network setups to trigger the task watchdog timeout panic. I saw that esphome's OTA component seems to have dealt with the same issue, temporarily raising the timeout value for a long operation and bringing it back down after. I'm wondering if this is too much of an edge case to get an "official" fix or if it's worth looking into.

See second report here esphome#4256 (comment)

@thomas0bernard this issue for your second report.

@thomas0bernard
Copy link

For esp-idf I just added CONFIG_ESP_TASK_WDT_TIMEOUT_S=10 to the build config and it was fine, albeit a bit of a dirty fix. Doesn't seem to be that easy for Arduino... I'll try to come up with a cleaner solution in a PR later this week.

@lhoracek
Copy link

I would leave this for later development as it is something that requires quite low level change.

@github-actions github-actions bot added the stale label May 31, 2023
Repository owner deleted a comment from github-actions bot May 31, 2023
@droscy droscy removed the stale label May 31, 2023
@thomas0bernard
Copy link

Came up with a bit of a cleaner solution in PR #5.

@droscy droscy closed this as completed in 2347dd7 Jun 1, 2023
@droscy droscy reopened this Jun 1, 2023
@droscy
Copy link
Owner Author

droscy commented Jun 1, 2023

I don't know how to slow down my DNS to trigger the watchdog, but the code looks good and my tests succeeded. Many thanks.

Just one tip, I changed

wdtc.timeout_ms = CONFIG_ESP_TASK_WDT_TIMEOUT_S;

to

wdtc.timeout_ms = CONFIG_ESP_TASK_WDT_TIMEOUT_S * 1000;

because it should be in milliseconds. Is that right?

Don't you mind if I wrap it in two functions suspend_wdt() and resume_wdt() for easier code reading? Please test them. Thanks.

@droscy
Copy link
Owner Author

droscy commented Jun 1, 2023

I cannot push to your branch, so test it using mine fix/wg/dns-wdt. Thanks.

@droscy
Copy link
Owner Author

droscy commented Jun 3, 2023

Many thanks @thomas0bernard, I've just merged your PR.

@droscy droscy closed this as completed Jun 3, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jun 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants