Mongo2Go: Azure DevOps throw "System.Net.Sockets.SocketException : An existing connection was forcibly closed by the remote host" occasionally

My unit test is very simple:

        [Fact]
        public async Task SomeTest()
        {
            using (var runner = MongoDbRunner.Start())
            {
                var myService = GetMyService(runner.ConnectionString);
                ...
            }
        }

It works fine in my dev machine. But may be failed with SocketException occasionally (~50% will be failed). System.Net.Sockets.SocketException : An existing connection was forcibly closed by the remote host

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

Just an addendum, I rolled back to 2.2.16 and works perfectly on Azure DevOps.

Something that me, @iron9light and @bart-degreed have in common: we are using xUnit. Seems that Mongo2Go uses Machine.Specifications. Maybe it’s related with the way xUnit runner works. I will try to come up with some sort of MVP to reproduce this as open source project, maybe comparing both Machine.Specifications and xUnit.