-
Notifications
You must be signed in to change notification settings - Fork 1.7k
The header of frame cannot be read from the stream #202
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
Comments
Hello there, Could you please describe MORE about both your client and server code?
That doesn't work in OnOpen. Do it in initializing. yourServer.AddWebSocketService<YourBehavior> (
"/YourServicePath",
() => new YourBehavior () { IgnoreExtensions = true }
); |
so, Thank you for your great work, I encountered same problem. I could reproduce it and I think this is because of overlay of send & receive. these operation around same stream should be ordered & isolated. Simply you can reproduce this problem as below.
The data length of receiving & sending bytes is actually correct. but payload contents is strongly mixed.
These degree of data mixing is very random. and sometimes raises these errors. logs here.
(number of line is maybe not match because I've added code for logging.) This situation is not so normal because it’s too high pressure(50 message receiving in 1 sec,),, but exists. actually I encountered that. |
@sassembla Hello there, Where does your So, could you please describe MORE about your environment and represent your repro code? Thanks for your attempt. |
Thank you for reply!, I'm using the WebSocketSharp which was downloaded from here (https://github.com/sta/websocket-sharp). Downloaded date is maybe 1~2 weeks ago. So I'm using Unity for running it. but it is not necessary to reproduce this problem. I've encountered this problem with Client: Win10 WebSocketSharp client. (compiled as C# 3.5 app) (,,Oh,,! so I bought the WebSocketSharpForUnity before. I forgot to test this case with it.) |
Should I write the repro case with Unity + WebSocketSharpForUnity? or Windows one? |
Windows one without Unity. |
OK! |
We had same problem on Windows 10 (and Windows 7) with .Net 4.0 and Firefox as client. We managed to fully fix it by modifying Therefore replacing: Note that there might be other places in the code where the same type of fix might be required based on your usage of this library. |
@OQO Hello there, If the connection is really closed, will your fix work?
It is very interesting. So, could you please let me know what public .NET documentation does describe about that ( |
The documentation only says that when the connection is being closed zero bytes is returned. It does not say the opposite: The documentation does not say that when zero bytes are being returned the connection is being closed. Note that the documentation does say that it will block until data is available. But it does not says that it will return the data in one time, or even always at least one or more bytes. The documentation is indeed very unclear. But, we have consistently observed this behavior. The When the connection is really closed and you still call |
Hi, I had same problem when close connection in OnMessage().
|
I had same problem. |
@Alcoholv your verison is work well on this problem?
I had same problem too. and I test your project can't use WSS connection. |
I met the same problem, but I couldn't repeat him. He may always be disconnected from the client. The probability of occurrence is not high. Each occurrence does not trigger the OnError event. The direct websocket service can not continue to run, and the service can only be restarted. I had set "IgnoreExtensions" to true when I started the service, but the problem was not solved. |
Same problem. Tried the fix posted by OQO and so far so good. Thank you OQO! |
Same issue here. Tried OQO's fix and it worked; or it seemed to. When the error would predictably happen, instead of throwing an error and crashing the client connection, it instead ramped up and created a bunch of threads. Hundreds. It eventually calmed back down to the default state. |
Has someone gotten a fix? This happens after the client is disconnected ... Every time |
@JohnWinner what is OQO. |
@zhujinhu21 haha it's a username. Scroll up a little bit and you will see him/her giving the fix. ;) |
did you found a solution to the pile of threads that are created?? |
2016-01-21 21:34:01|Fatal|<>c__DisplayClass2c.b__2b:1601|WebSock
etSharp.WebSocketException: The header of a frame cannot be read from the stream
.
at WebSocketSharp.WebSocketFrame.processHeader(Byte
[] header) in C:\User\Promises\Desktop\websocket-sharp-master\websocket-sharp\WebSocketFrame.cs:line
429
at WebSocketSharp.WebSocketFrame.<>c__DisplayClassa
.b__9(Byte[] bytes) in C:\User\Promises\Desktop\websocket-sharp-master\websocket-sh
arp\WebSocketFrame.cs:line 529
at WebSocketSharp.Ext.<>c__DisplayClass9.b__8(IAsyncResult ar) in C:\User\Promises\Desktop\websocket-sharp-master\websocket-sharp\Ext.cs:line 651
Client Disconnected [An exception has occurred while receiving.]
Chrome: Worked
Firefox 39: not working
i saw some resolutions in the issue's and i added "this.IgnoreExtensions = true;" to OnOpen but i didnt work.
Server: Windows 7
Client: Windows 7 & Windows XP
The text was updated successfully, but these errors were encountered: