Skip to content

Network error when reconnecting to database. #86

@rowland

Description

@rowland

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.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions