[Mono-bugs] [Bug 644936] NetworkStream.Read() block and use 100% CPU if the socket has been shutted down

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Oct 8 14:20:16 EDT 2010


https://bugzilla.novell.com/show_bug.cgi?id=644936

https://bugzilla.novell.com/show_bug.cgi?id=644936#c2


Gonzalo Paniagua Javier <gonzalo at novell.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #2 from Gonzalo Paniagua Javier <gonzalo at novell.com> 2010-10-08 18:20:15 UTC ---
I ran this test from windows connecting to linux (netcat) and killed netcat
after the 'get mykey' message. Windows behaved exactly as we do.

The problem is in the error condition in your program.

>From MSDN docs:
"This method reads data into the buffer parameter and returns the number of
bytes successfully read. If no data is available for reading, the Read method
returns 0. The Read operation reads as much data as is available, up to the
number of bytes specified by the size parameter. If the remote host shuts down
the connection, and all available data has been received, the Read method
completes immediately and return zero bytes."

I would change the error condition to be <= 0 instead of -1.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list