NoRM icon indicating copy to clipboard operation
NoRM copied to clipboard

Network error when reconnecting to database.

Open rowland opened this issue 14 years ago • 0 comments

After connecting to and disconnecting from a database and a period of inactivity, reconnecting triggers this error:

System.ObjectDisposedException: Cannot access a disposed object. at System.Net.Sockets.TcpClient.GetStream() at Norm.Connection.GetStream() in x:\dev.net\lib\NoRM\NoRM\Connections\Connection.cs:line 133 at Norm.Connection.Write(Byte[] bytes, Int32 start, Int32 size) in x:\dev.net\lib\NoRM\NoRM\Connections\Connection.cs:line 164 at Norm.Protocol.Messages.QueryMessage2.Execute() in x:\dev.net\lib\NoRM\NoRM\Protocol\Messages\QueryMessageGeneric.cs:line 100 at Norm.MongoQueryExecutor2.<GetEnumerator>d__0.MoveNext() in x:\dev.net\lib\NoRM\NoRM\MongoQueryExecutor.cs:line 57 at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source) at Norm.Collections.MongoCollection1.FindOne[U](U template) in x:\dev.net\lib\NoRM\NoRM\Collections\MongoCollectionGeneric.cs:line 214

I suspect a network connection remained after "disconnecting" due to connection pooling being enabled, but the connection was likely severed by our firewall due to inactivity. Upon "reconnecting," the first request triggers the error above.

Unfortunately, disabling connection pooling leads to nasty errors much earlier and without the periods of inactivity.

I upgraded NoRM to the latest because I spotted an update awhile back that looks like it might solve this issue, but apparently that's not the case.

rowland avatar Dec 15 '11 17:12 rowland