-
Notifications
You must be signed in to change notification settings - Fork 491
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
LWIP Update- Function called without core lock #576
Comments
The option We should correct any problems in the esp-open-rtos code. An attempt was made try to guard all the calls into lwipl, but perhaps there are still some calls into lwip from the sdk binary for which we do not have source code. If you could narrow down an example that would help. Lwip has a range of APIs, callbacks, and sockets. Probably best to study lwip to learn more. The esp-open-rtos fork of lwip is very close to the upstream version. |
Once I finish up my extras/timekeeping for a pull request, I'll probably dive into this deeper. I'm tempted to replace the nagging message with a forced crash so I can get a stack dump. Is there a better way to get a stack dump printed than I get the messages even when only calling LWIP-supplied code and it doesn't appear to be part of the DHCP negotiation:
The "SNTP:" line is printed within the implementation of
For the curious, yes, I've got a fully working set of |
Ooh, I have been meaning to implement SNTP a little better... I did just force a crash real quick out of curiosity. The only thing I see in the stack so far is There's calls to |
Fwiw I went through a similar thought process, but with the mdns code. I started submitting patches to make the mdns api thread safe, and added support to the netif-api code, which can either use locking or message passing. It was patiently explained that lwip has different styles of code, some are thread safe such as the sockets api, and then there is the callback style. The callback style assumes that it all runs in one thread. When mixing multiple threads with the callback style of interface it is necessary to acquire the lwip lock around calls into lwip. There was even mention that the message passing approach might be deprecated as it was a big burden compared with locking, but no decision was made. They added the core lock checks to help developers write safe code. Perhaps that discussion would help to see their perspective: https://savannah.nongnu.org/bugs/index.php?52770 |
If I've found the right spot, from Phew! Other than potentially locking out another thread that is using LWIP, there doesn't look to be any "harm" in taking the lock. (The |
Since the LWIP update
LWIP_TCPIP_CORE_LOCKING
now defaults to 1. From what I've been able to find, this is to allow the application to avoid a few context changes by providing its own mutex.The client is supposed to call
LOCK_TCPIP_CORE()
etc, but I'm not entirely clear on where that's supposed to happen in esp-free-rtos. I see it peppered throughout the project, but not in any examples.The end result is the message "Function called without core lock" being repeated on the uart.
The text was updated successfully, but these errors were encountered: