mirbeta / fluorinefx

Automatically exported from code.google.com/p/fluorinefx
0 stars 0 forks source link

rtmpNetworkStream.BeginRead not finishing #16

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using the latest version from the repository (1.0.0.17) on Windows 2008 
server.

Since my website receives relatively good amount of traffic, every day a 
"crazy" client connects which opens up over a thousand concurrent connections. 
Here's what happens:
1) the client establishes a new connection
2) it sends a normal message such as Idle, however the body of the message is 
empty
3) the RtmpServerConnection resets the stream pointer back to the beginning and 
issues another _rtmpNetworkStream.BeginRead expecting that next time all of the 
data will be read
4) the async call to BeginReadCallbackProcessing never happens
5) the client opens a new connection and sends the next message as if nothing 
is wrong

My guess is that the client is behind some sort of a proxy server such as 
Squid, which somehow interferes with the messages.

I have solved this by adding another wait job similar to the WaitForHandshake, 
which is scheduled to run when the RtmptProtocolDecoder.DecodeBuffer detects 
that not all the data was received. The DecodeBuffer also needed to be changed 
so that it now returns a boolean value indicating if all has been received, 
while the RtmpRequest is returned as an out parameter.

If the BeginReadCallbackProcessing method gets called, the job gets 
unscheduled. If not, the job fires and closes the connection - similar as the 
the WaitForHandshake does.

This fix however causes another problem: although the RtmpServerConnection gets 
closed, the RtmptConnection instance remains.

In the attachment you can find both of the files.

Original issue reported on code.google.com by nikola.d...@gmail.com on 25 Aug 2010 at 12:43

Attachments: