lwIP - A Lightweight TCP/IP stack - Bugs: bug #32784, Race condition when sending to UDP...
You are not allowed to post comments on this tracker with your current authentication level.
bug #32784: Race condition when sending to UDP socket from multiple threads
Submitter: | Ken MacKay <kmackay> | ||
Submitted: | Mon 14 Mar 2011 09:10:57 PM UTC | ||
Category: | UDP | Severity: | 3 - Normal |
Item Group: | Faulty Behaviour | Status: | Wont Fix |
Privacy: | Public | Assigned to: | goldsimon |
Open/Closed: | Closed | Planned Release: | None |
lwIP version: | CVS Head |
Mon 14 Mar 2011 09:24:00 PM UTC, comment #1: |
Simon Goldschmidt <goldsimon> |
Mon 14 Mar 2011 09:10:57 PM UTC, original submission:
When multiple threads are sending over the same UDP socket (using sendto()), there is a race condition in tcpip_apimsg(). What happens is that one thread (thread 1) enters tcpip_apimsg() and posts to the tcpip thread. The tcpip thread then runs the do_send function and signals the conn->op_completed semaphore. Then the tcpip thread goes back to blocking on the mbox.
|
Ken MacKay <kmackay> |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follow 3 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2011-03-14 | goldsimon | Status | None | Wont Fix | |
Assigned to | None | goldsimon | |||
Open/Closed | Open | Closed |
Powered by Savane 3.13-bb6a.
Corresponding source code
Sorry to turn you down on this, but sharing a socket between multiple threads is not supported in lwIP. It's just a limitation imposed by the 'lw' in lwIP. Doesn't depend on the protocol, it doesn't work for RAW and TCP, too: when I started with lwIP, I expected this to work for TCP to be able to read from one thread while writing from another to implement a full-duplex protocol.
You can work around this by using a semaphore (as you stated), but it's not planned to be integrated into our CVS code, currently.