[Unstable code] So you think you are safe...
There is some interesting discussion on my previous post about unstable code.
I thought that it would be good to give a concrete example of the issue. Given the following interface & client code, is there a way to make this code block for a long time?
[ServiceContract] public interface IFoo { [OperationContract] string GetMessage(); } var stopwatch = Stopwatch.StartNew(); var channel = ChannelFactory<IFoo>.CreateChannel( new BasicHttpBinding { SendTimeout = TimeSpan.FromSeconds(1), ReceiveTimeout = TimeSpan.FromSeconds(1), OpenTimeout = TimeSpan.FromSeconds(1), CloseTimeout = TimeSpan.FromSeconds(1) }, new EndpointAddress("http://localhost:6547/bar")); var message = channel.GetMessage(); stopwatch.Stop(); Console.WriteLine("Got message in {0}ms", stopwatch.ElapsedMilliseconds);
You are free to play around with the server implementation as well as the network topology.
Have fun....
Comments
Lots of ways. Your timeout only applies to the binding; there's many other things that could take some time: the DNS lookup (some DNS implementations lookup "localhost"), the TCP listener on the server could do something funky and take some time, etc.
The title reminded me [ThereBeDragonsAttribute] :)
You could respond with a byte every 500ms for a very long time..
You could use a redirect loop :-)
damn, reading your blog through an rss reader means I missed the fact that you allready posted the solution ;-)
Comment preview