Bug 3805 - NetworkStream.BeginRead never completes
Summary: NetworkStream.BeginRead never completes
Alias: None
Product: Runtime
Classification: Mono
Component: io-layer ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Gonzalo Paniagua Javier
Depends on:
Reported: 2012-03-07 21:27 UTC by Pablo Ruiz García
Modified: 2012-03-08 14:38 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Sample program demostrating the issue (1.60 MB, application/x-compressed)
2012-03-07 21:27 UTC, Pablo Ruiz García

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Pablo Ruiz García 2012-03-07 21:27:18 UTC
Created attachment 1479 [details]
Sample program demostrating the issue

While using LumiSoft.Net.dll (a library with implementations of many kind of internet protocols like IMAP, SMTP, FTP, etc.), I've found that a simple TCP server sockets program (an SMTP server in this specific case) works fine on Windows, but fails works on Linux.

The actual problem is the receiver side of the socket hungs and doesnt pass received data from kernel back to the application... The same program runs just fine on windows, and even on mono/win32.

After inspecting the code a bit, it looks like calls to NetworkStream:BeginRead() seem to work ok, but end up never calling the completed callback.

I've arranged an small test program which uses LumiSoft.Net.dll. You can find the sample program (sample.cs) and LumiSoft.Net.dll (in binary & source form) attached to this issue.

To demostrate the issue:

 1) Build sample: gmcs -target:exe -out:sample.exe -reference:Common.Logging.dll -reference:LumiSoft.Net.dll sample.cs
 2) Launch program: mono sample.exe
 3) Then, from another terminal, execute: telnet 587
 4) You will see a Simple SMTP server banner.
 5) Write something and prest enter.
 6) Nothing will be sent back from the server.. :(

NOTE: You might need to change the port opened by the sample program (587), to do so, look for '587' at sample.cs
Comment 1 Pablo Ruiz García 2012-03-07 21:27:56 UTC
Changed component to runtime.
Comment 2 Pablo Ruiz García 2012-03-07 21:30:36 UTC
Forgot to mention, it was tested against mono 2.10.5.
Comment 3 Gonzalo Paniagua Javier 2012-03-08 14:38:37 UTC
Fixed in mono-2-10/e040f44 and master/70c64f1