Timeout Exception on VSTS Test Platform (Azure DevOps), with private build agent #155

Closed
opened 2025-12-29 14:23:51 +01:00 by adam · 5 comments
Owner

Originally created by @Tieno on GitHub (Nov 26, 2018).

In release 1.4.20 I get a timeout exception everytime the test agent tries to start the FluentMockServer

Following exception is thrown right after
"FluentMockServer.Start()"

System.TimeoutException : Service start timed out after 00:00:10
Stack trace
   at WireMock.Server.FluentMockServer..ctor(IFluentMockServerSettings settings) in /Server/FluentMockServer.cs:line 225
   at WireMock.Server.FluentMockServer.Start(Nullable`1 port, Boolean ssl) in /Server/FluentMockServer.cs:line 110

I don't get this when running the test locally.
I've tried turning off the windows firewall entirely, on the build machine, but it doesn't make any difference. I still get the timeout exception.
After seeing issue #146, I reverted to version 1.3.18 and I don't experience any timeout exception anymore.

Anybody know what's causing the timeout exception?

Originally created by @Tieno on GitHub (Nov 26, 2018). In release 1.4.20 I get a timeout exception everytime the test agent tries to start the FluentMockServer Following exception is thrown right after `"FluentMockServer.Start()"` ``` System.TimeoutException : Service start timed out after 00:00:10 Stack trace at WireMock.Server.FluentMockServer..ctor(IFluentMockServerSettings settings) in /Server/FluentMockServer.cs:line 225 at WireMock.Server.FluentMockServer.Start(Nullable`1 port, Boolean ssl) in /Server/FluentMockServer.cs:line 110 ``` I don't get this when running the test locally. I've tried turning off the windows firewall entirely, on the build machine, but it doesn't make any difference. I still get the timeout exception. After seeing issue #146, I reverted to version 1.3.18 and I don't experience any timeout exception anymore. Anybody know what's causing the timeout exception?
adam closed this issue 2025-12-29 14:23:51 +01:00
Author
Owner

@StefH commented on GitHub (Nov 26, 2018):

  • Do you run on Linux or Windows build ?
  • And which framework?

(BTW : The DevOps pipeline used by WireMock itself works fine.)

@StefH commented on GitHub (Nov 26, 2018): * Do you run on Linux or Windows build ? * And which framework? (BTW : The DevOps pipeline used by WireMock itself works fine.)
Author
Owner

@Tieno commented on GitHub (Nov 26, 2018):

  • Windows Build. Machine itself runs Windows 8.
  • .NET Framework 4.7
  • XUnit 2.2
  • Visual Studio Test Platform (Installer)
@Tieno commented on GitHub (Nov 26, 2018): - Windows Build. Machine itself runs Windows 8. - .NET Framework 4.7 - XUnit 2.2 - Visual Studio Test Platform (Installer)
Author
Owner

@backlune commented on GitHub (Nov 30, 2018):

Been having the same issue on one of our slower build servers. The reason for getting a TimeoutException might be different as some exceptions are not observed when starting the server.

To find out why we were getting TimeoutException I changed to checking it the task had an exception before throwing timeout in FluentMockServer constructor.

            var startTask = _httpServer.StartAsync();

            using (var ctsStartTimeout = new CancellationTokenSource(settings.StartTimeout))
            {
                while (!_httpServer.IsStarted)
                {
                    // Throw out exception if service start fails
                    if (_httpServer.RunningException != null)
                    {
                        throw new Exception($"Service start failed with error: {_httpServer.RunningException.Message}", _httpServer.RunningException);
                    }

                    // Respect start timeout setting by throwing TimeoutException
                    if (ctsStartTimeout.IsCancellationRequested)
                    {
                        if (startTask.Exception != null) { throw startTask.Exception; }
                        throw new TimeoutException($"Service start timed out after {TimeSpan.FromMilliseconds(settings.StartTimeout)}");
                    }

                    ctsStartTimeout.Token.WaitHandle.WaitOne(ServerStartDelay);
                }
            }

In our case a System.IO.FileNotFoundException was being thrown (Not sure why yet but seen some issue with our nugetpackages)

@backlune commented on GitHub (Nov 30, 2018): Been having the same issue on one of our slower build servers. The reason for getting a `TimeoutException` might be different as some exceptions are not observed when starting the server. To find out why we were getting `TimeoutException` I changed to checking it the task had an exception before throwing timeout in FluentMockServer constructor. ``` c# var startTask = _httpServer.StartAsync(); using (var ctsStartTimeout = new CancellationTokenSource(settings.StartTimeout)) { while (!_httpServer.IsStarted) { // Throw out exception if service start fails if (_httpServer.RunningException != null) { throw new Exception($"Service start failed with error: {_httpServer.RunningException.Message}", _httpServer.RunningException); } // Respect start timeout setting by throwing TimeoutException if (ctsStartTimeout.IsCancellationRequested) { if (startTask.Exception != null) { throw startTask.Exception; } throw new TimeoutException($"Service start timed out after {TimeSpan.FromMilliseconds(settings.StartTimeout)}"); } ctsStartTimeout.Token.WaitHandle.WaitOne(ServerStartDelay); } } ``` In our case a `System.IO.FileNotFoundException` was being thrown (Not sure why yet but seen some issue with our nugetpackages)
Author
Owner

@StefH commented on GitHub (Nov 30, 2018):

https://github.com/WireMock-Net/WireMock.Net/pull/235

@StefH commented on GitHub (Nov 30, 2018): https://github.com/WireMock-Net/WireMock.Net/pull/235
Author
Owner

@StefH commented on GitHub (Nov 30, 2018):

version 1.0.4.21 will implement code fixes as proposed by @backlune

@StefH commented on GitHub (Nov 30, 2018): version 1.0.4.21 will implement code fixes as proposed by @backlune
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#155