You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to bring back #287. I stumbled on it, and I think it has to be mentioned in the documentation and an example of writing HTTP server with state would be ideal.
I have next scenario:
I have an app mutex which protects the app data and list of web socket sessions.
The main thread waits for an event, obtains the mutex, store some data and notify clients by web socket.
On event clients make HTTP query and get the data.
The handler for get data locks and send the data.
Because of the single thread server main thread holding the lock and trying to send which waits for result and the server thread trying to obtain the lock to get access to data.
I think it should work If I split the mutex in two, one for data and one for web socket sessions, and I also use a channel to handle web socket events.
The text was updated successfully, but these errors were encountered:
I'm not sure what else I could add to the topic, besides pointing you to this explanation.
Also, I'm not really sure in the details of your implementation, as it is explained with a few words, rather than with code.
I can only speculate, but it seems you are deadlocking by the virtue of you utilizing a simple blocking mutex rather than a channel or something similar.
Perhaps an easy(er) solution would be to just send the data when you are no longer holding the lock?
I want to bring back #287. I stumbled on it, and I think it has to be mentioned in the documentation and an example of writing HTTP server with state would be ideal.
Yes, that would be ideal. However, if somebody does not do it, it will be never done.
The thing is, the esp-idf-* crates are a community effort, so things to get moving we do need support (in the form of PRs) from the community. I neither work for Espressif, nor am I paid for any time I dedicate for the esp-idf-*crates.
In the meantime, I've moved away from the ESP IDF websockets client/server impls, as they are not really async, and have a lot of restrictions. I am personally actively working on and trying to use edge-http instead.
But we have to be transparent with the community as to what level of support they could expect in the esp-idf-* crates. Or else we might build wrong expectations.
We may even put some wording in the READMEs that this effort is not sponsored by Espressif soon.
I want to bring back #287. I stumbled on it, and I think it has to be mentioned in the documentation and an example of writing HTTP server with state would be ideal.
I have next scenario:
Because of the single thread server main thread holding the lock and trying to send which waits for result and the server thread trying to obtain the lock to get access to data.
I think it should work If I split the mutex in two, one for data and one for web socket sessions, and I also use a channel to handle web socket events.
The text was updated successfully, but these errors were encountered: