Closed twenty2811 closed 1 month ago
You can't leave a socket corked, if you cork it you need to uncork it before returning from whatever event you were called
It can also be that you have some threading misuse. Nobody in JavaScript camp has reported this issue, but I have seen it reported by C++ users who play with corking / threading. You are doing C++, yes?
Thank you for you reply. Yes, I'm using in C++ environment. I'm still thinking your first reply and trying to figure out what could the the reasons.
Environment:
By the way, uWebSockets is not multithreaded in my use case, though for each new connection, I started a websocket connection with another websocket server.
Correction:
The problem seems to relate to the new threads that holds the "uWS::WebSocket<_> *ws" pointer for later use, which is against the rule of this library "isolated to only one thread".
Description:
When using uWebSockets as a server, I had occasionally encountered the following message:
"Error: Cork buffer must not be acquired without checking canCork!"
it would stop my whole program.
Since the "bug" is not easily reproduced, I traced the source code and try to figure out what might be the reason for the error.
The error message comes from "AsyncSocket.h", and the "cork()" function might be called from the following code from "WebSocketContext.h" (the other place is "HttpContext.h", but that has less possibility in my use case):
Questions:
The error message states that "canCork()" should always be called before "cork()", but here "asyncSocket->cork();" without this check beforehand. So, my questions are the following:
Environment: