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
. This starts a read call on the socket, which asynchronously waits for data
Task B calls dataAvailableForRead on the socket, which also sets up a read call.
The web messages are coming in with the correct timing such that both reads succeed, but not in sync. Therefore, the assert is hit because there is still data on the buffer.
At least, I believe this is the case, it is hard to tell.
I think the correct fix is to have dataAvailableForRead to avoid attempting a read on websockets, and just only check for buffer data available.
The text was updated successfully, but these errors were encountered:
If you have a simple web page which just sends
hello
every 1 msec, and then you have the server read in a loop like this:You will run into a crash.
The issue is that when a WebSocket is created, it starts a read task, which reads messages as they come in.
But the call to
dataAvailableForRead
boils down to also trying a read if there is no data available.Having both these tasks reading at the same time causes this assert to fail:
https://github.com/vibe-d/vibe-core/blob/master/source/vibe/core/net.d#L663
The sequence of events is:
vibe-http/source/vibe/http/websockets.d
Line 991 in 7e4c53e
dataAvailableForRead
on the socket, which also sets up a read call.At least, I believe this is the case, it is hard to tell.
I think the correct fix is to have
dataAvailableForRead
to avoid attempting a read on websockets, and just only check for buffer data available.The text was updated successfully, but these errors were encountered: