Fixed freezing issue in XAsyncSockets lib and updated thread locking#26
Fixed freezing issue in XAsyncSockets lib and updated thread locking#26ElHyperion wants to merge 1 commit into
Conversation
|
Hello @ElHyperion, |
|
After more thorough testing, I think the problem appears with the socket lock I use right before sending text messages. Any recommendations on how to change it? I had it without _socket_lock at first, with the same freezing issue, and thought that adding the lock to it would fix the problem. UPDATE: Is this two-way communication too much for a single socket, and should I use two sockets instead? Or is the issue somewhere else? This is XAsyncSockets with added prints: This is the code I use for sending text messages over sockets: Remove: locked 60 2 |
|
I'm checking all but I don't understand how this _opLock can stay locked 😞 |
|
I start it with no arguments. Adding Setting I'll be testing it on a WROVER kit with 8MB SRAM soon, if that helps. |
|
Ok. |
|
I encountered same situation -- thread is locked. My solution is as below: it works. |
|
The asynchronous concurrent thread system has just been redesigned. It now uses a battery of workers, so there should be no more problems. |
I started this pull request to fix an issue I got:
I have a server running with embedded config on an ESP32 which often froze on
socket.SendTextMessage(message)which I'm calling once every second with only an 81 byte-long message. I traced down the issue all the way to _socketListRemove where it sometimes hangs forever onsocketsList.remove(socket). Since it never returns from this command and stays locked when _socketListAdd wants to use it already, the sockets stay frozen forever.Returning False if the _opLock is locked fixed the problem for me but it's rather a quick workaround with which I just wanted to point out the issue and discuss the solutions. Before returning False, I tried printing
len(socketsList)which always returned 0 on me, so I guess the .remove got processed anyways.I also remade thread locking using the 'with' statement. Tested and it works the same, but is more elegant (and reliable?)