Timeouts fixed by reboot

Dec 7, 2015 at 9:47 AM
Edited Dec 13, 2015 at 9:42 AM
Hi Svet,

I sometimes find my tests timeout when making a call to a request response mock port. Once I have one timeout, then I get each time until I reboot the server, then all is good again. Prior to reboot I tried restarting the host instances and "full stop" / start of the BizTalk application but that didn't help.

Can you guess what it is about a reboot that fixes the timeout problem? Perhaps there's a less drastic "reset" action I could script to run before my Transmock tests?

Here is an example test. This runs ok first time but times out on each subsequent run, until I reboot.
[TestClass]
    public class InvarStockUpdate
    {
        [TestMethod]
        [DeploymentItem(@"TestInput\Stk_SmallInvarUpdate.xml")]
        public void IntTest_InvarStockUpdate()
        {
            TestCase testCase = new TestCase();

            var sendStockStep = new MockSendStep()
            {
                RequestPath = "Stk_SmallInvarUpdate.xml",
                Encoding = "UTF-8",
                Url = MockEndpoints.ReceiveInvarStockProcess
            };
            testCase.ExecutionSteps.Add(sendStockStep);

            var delayStep = new BizUnit.TestSteps.Time.DelayStep()
            {
                DelayMilliSeconds = 5000
            };
            testCase.ExecutionSteps.Add(delayStep);

            var receiveUpdateStep = new MockReceiveStep()
            {
                Url = MockEndpoints.SendStockToFusion,
                Encoding = "UTF-8",
                Timeout = 5
            };
            testCase.ExecutionSteps.Add(receiveUpdateStep);

            BizUnit.BizUnit testRunner = new BizUnit.BizUnit(testCase);

            testRunner.RunTest();
        }
    }
Thanks,

Rob.
Coordinator
Dec 12, 2015 at 9:53 PM
Hi Rob, interesting behaviour. Have you perhaps tried to drop the delay step. The Timeout=5 construct denotes that the receive step will wait for 5 secs before throwing TimeoutException. If you want to wait for 10 seconds then simply set Timeout=10. The behaviour of the test in this case differs as compared to having the delay step, as the delay step will always pause the test execution for the defined time. The Timeout property defines the maximum wait time before the step times out. This means if you have it set to 5 secs and the message arrives in 3, the test execution will continue after 3 seconds.
The above suggestion is just something you can try. I have no idea of what might cause such severe error so that the only way to be solved is to reboot the entire box. I would suggest to have Procmon executing while you run the test when it times out and see if the connections to the named pipes are established as expected, or something prevents that. I suspect that this is what happens and since named pipes are OS resources, there might be some intrinsic condition that is just provoked by running such test which leads to the observed behaviour, But this is only me thinking loud, it definitely need more digging to find exactly what causes this issue.
Dec 13, 2015 at 9:50 AM
Hi Svet,
Thanks for your response. To be honest I'd forgotten I'd added the delay step, I think I did this during troubleshooting. Your suggestion was a great one, when I remove the delay step then the test works each time :)

I can't explain the strange behavior of it working first time then failing for each subsequent run if the delay step is in place but that's not going to hold me up.

Thanks again for your help. I think Transmock is wonderful!

Rob.
Coordinator
Dec 14, 2015 at 10:55 AM
Hi Rob, i am glad my thinking-loud-while-writing born suggestion actually helped! I agree it is very strange why this happens if there is a delay step, but will definitely try to reproduce it locally and see if I can track down the root cause. Definitely some weird combination of the way Delay step and the TransMock steps utilizing underlying resources.

Cheers, Svet