11
Vote

net_io_connectionclosed?

description

I sometimes get an application exception: Unable to read data from the transport connection: net_io_connectionclosed.
 
I'm unable to reproduce consistently, and usually retrying the email fixes it.

comments

korggy wrote Aug 27, 2011 at 5:19 PM

I am getting this too. The exception detail follows, I'll try to create a test app that reproduces the problem.

System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.DelegatedStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.BufferedReadStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)
at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)
at System.Net.Mail.CheckCommand.Send(SmtpConnection conn, String& response)
at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from)
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
--- End of inner exception stack trace ---
at System.Net.Mail.SmtpClient.Send(MailMessage message)

wrote Feb 28, 2012 at 5:36 PM

WorkAByte wrote Feb 28, 2012 at 5:37 PM

not consistent for me, happens same code block less than 50% of the time.

wrote Feb 28, 2012 at 6:09 PM

wrote Mar 29, 2012 at 3:17 PM

ryanfinken wrote Mar 29, 2012 at 3:19 PM

I am having the exact same issue and it is sporadic for me as well.

gleeds wrote Jun 13, 2012 at 5:30 PM

I have run into this issue too, it happens pretty consistently if you send several emails in rapid succession. I'm testing a windows service that sends batches of emails and I usually have this happen after a few emails.

wrote Jun 13, 2012 at 5:30 PM

wrote Aug 7, 2012 at 10:25 AM

bsmithza wrote Aug 7, 2012 at 12:57 PM

I also had this problem. It looks like it's related to the number of emails you save in smtp4dev and consequently the memory usage of smtp4dev, and possibly the amount of available memory on your machine (I did not have much available after SMTP4Dev was running).

My bulk mailing app handles large volumes ( a few thousand) with small attachments so I set the smpt4dev to keep 10000 emails for testing purposes. It handles SMTP errors returned, so starts a new smtp session and re-sends the email which then succeeds. But the important thing is I can then see this error occurring repeatedly and at random, although the trend is that the longer smtp4dev runs it becomes more frequent.

I found that this occurs especially once a high volume of emails (a few hundred) has been sent and saved in smpt4dev. The smpt4dev executable size in memory grows to around 400MB depending on the email size. Once I had about 1000 saved emails it was only managing to send 1 email before generating this error and having to start a new smtp session.

While my bulk mailer was running and this error was occurring I deleted most of the saved emails in smtp4dev and immediately the next session handled 158 mails before encountering the same problem.

I saw the 2.1 alpha release has a facility to instead save the messages to a folder, so I installed this and set it to use folder. Not only do I not get the error anymore but I also found the email throughput was 10 fold faster. I also noticed that the smtp4dev executable is nowhere near as large as 400MB after processing 1000 emails, its around 25MB.

So its fair to say this issue is really addressed by the 2.1 Alpha release. And a big thumbs up for the alpha release :)

wrote Feb 22, 2013 at 12:30 AM

wrote Apr 4, 2013 at 7:58 AM

wrote Sep 18, 2013 at 6:41 AM

peterrow wrote Oct 24, 2013 at 3:05 PM

This is a very annoying issue. I get the same exception as korggy.
I've tried:
  • stop listening, start listening
  • quitting smtp4dev, restarting
  • restarting IIS and quitting smtp4dev and restarting
    ... in all cases the very next email my web app attempts to send - bang exception at the point at which it SmtpClient.Send() just like in the stack trace.
Bump this for a fix.
About to try a VS studio restart followed by a machine reboot.

wrote Oct 28, 2013 at 3:59 PM

noral wrote Nov 5, 2013 at 11:58 PM

I just spent two days trying to figure out what was wrong with my code and as it turns out it was this utility causing issue.

This is a wonderful utility - please fix.

rnwood wrote Nov 6, 2013 at 7:02 AM

Hi to everybody with this error.

Please can you try the following release and let me know if this fixes it:
http://smtp4dev.codeplex.com/releases/view/55756

cipsoftware wrote Feb 5, 2015 at 10:12 AM

I believe 2.1 alpha 1 has fixed this. This issue did not occur anymore in my (small) test, whereas it occurred quite frequently in 2.0.9.

Thanks!