[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #65996] tcp_output() crashes in multithread system
From: |
Andrey Vinogradov |
Subject: |
[lwip-devel] [bug #65996] tcp_output() crashes in multithread system |
Date: |
Tue, 16 Jul 2024 12:43:58 -0400 (EDT) |
URL:
<https://savannah.nongnu.org/bugs/?65996>
Summary: tcp_output() crashes in multithread system
Group: lwIP - A Lightweight TCP/IP stack
Submitter: andreyvinogradov
Submitted: Tue 16 Jul 2024 04:43:56 PM UTC
Category: TCP
Severity: 3 - Normal
Item Group: Crash Error
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release: None
lwIP version: git head
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Tue 16 Jul 2024 04:43:56 PM UTC By: Andrey Vinogradov <andreyvinogradov>
Program can call tcp_output() from tcp_input() from input interrupt exact in
same time tcp_output() already in progress.
I constantly reproduce problem in tcp_output() with pcb->unacked turning form
NULL to nonNULL right after nullptr check.
You need to add mutex befor tcp_output() call if program work in several
threads. For example:
```
static inline err_t
do_tcp_output(struct tcp_pcb *pcb)
{
// tcp_output() code here
...
}
err_t
tcp_output(struct tcp_pcb *pcb) {
static u8_t tcp_out_lock = 0;
while (tcp_out_lock) {
}
tcp_out_lock = 1;
err_t res = do_tcp_output(pcb);
tcp_out_lock = 0;
return res;
}
```
_______________________________________________________
Reply to this item at:
<https://savannah.nongnu.org/bugs/?65996>
_______________________________________________
Message sent via Savannah
https://savannah.nongnu.org/
signature.asc
Description: PGP signature
- [lwip-devel] [bug #65996] tcp_output() crashes in multithread system,
Andrey Vinogradov <=