examples/device/net_lwip_webserver/src/main.c random crashes and hangs
Maintainers usually reply within 6 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- c
- Domain
- embedded-iot
Research direction
Start with examples/device/net_lwip_webserver/src/main.c and inspect linkoutput_fn, then trace how tud_task() and the lwIP output callback interact in this example. Check the example's existing network tests or build instructions, if present. Done means transmission no longer calls lwIP recursively, and the failure return code follows lwIP's expected behavior.
Written by the indexing model from the issue text.
Description
In this function:
static err_t linkoutput_fn(struct netif *netif, struct pbuf *p) {
(void) netif;
for (;;) {
/* if TinyUSB isn't ready, we must signal back to lwip that there is nothing we can do */
if (!tud_ready())
return ERR_USE;
/* if the network driver can accept another packet, we make it happen */
if (tud_network_can_xmit(p->tot_len)) {
tud_network_xmit(p, 0 /* unused for this example */);
return ERR_OK;
}
/* transfer execution to TinyUSB in the hopes that it will finish transmitting the prior packet */
tud_task(); **/* <= this may call lwip recursively, which isn't allowed by lwip and can cause data corruption of lwip data */**
}
}
"tud_task()" might call prohibited functions of the lwip stack recursively and will cause random hangs, crashes and data corruption.
Why is it a loop?
Also if this function fails, it is supposed to return ERR_MEM, not ERR_USE.
Is this an error not noticed yet?
- Dominant language
- C
- Stars
- 5k
- Forks
- 1.3k
- Avg merge
- 12d 19h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raspberrypi/pico-sdk
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
raspberrypi/pico-sdk#3300 ·
Maintainers usually reply within 6 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/pico-sdk#3292 ·
Maintainers usually reply within 6 days
-
Add masked GPIO pull configuration APIsPossibly taken A pull request linked to this issue is open or already merged. Openhardware_gpio
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/pico-sdk#3279 ·
Maintainers usually reply within 6 days
-
hardware_pll doxygen doesn't mention RP2350Possibly taken A pull request linked to this issue is open or already merged. Opendocumentation
Difficulty 1/5 Under an hour Newbie friendliness 91/100
raspberrypi/pico-sdk#3277 ·
Maintainers usually reply within 6 days
-
multicore_lockout_handler calling non-inlined multicore_fifo_push_blocking_inlinePossibly taken @Wooohaaa claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
raspberrypi/pico-sdk#3225 · 2 comments ·
Maintainers usually reply within 6 days
All issues in raspberrypi/pico-sdk
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
slice
Difficulty 2/5 Under an hour Newbie friendliness 72/100
Life-Framework/Life-Framework#3465 ·
Maintainers usually reply within 1 day