0

I'm using WCF for IPC. There is a server and single client only, both .Net3.5 and run on the same machine, not elevated, without any system settings altered (under normal use).

This runs without issue in all clients (from WinXp to Win8). But only in one machine a TimeoutException occurs in the client application after around 20 minutes of communication. This behavior cannot be replicated elsewhere but is being replicate in the client the same way every time. During the application lifetime several calls are being made, I would say around hundred at least. The stack is at the bottom of the question.

The service contract

[ServiceContract]
interface IExampleService
{
    [OperationContract]
    string TestSample();
}

service contract implementation

[ServiceBehavior(IncludeExceptionDetailInFaults = true,
                 InstanceContextMode = InstanceContextMode.Single)]
internal class ExampleService : IExampleService
{
    // IExampleService implementation
}

Server initialization (Always starts before client)

// Server initialization
Uri baseAddress = new Uri("net.pipe://127.0.0.1/Example");
NetNamedPipeBinding binding = new NetNamedPipeBinding();
var service = new ExampleService();
ServiceHost serviceHost = new ServiceHost(service, baseAddress);
serviceHost.AddServiceEndpoint(typeof(IExampleService), binding, baseAddress);
serviceHost.Open();

Client initialization

// Client initialization
EndpointAddress address = new EndpointAddress(new Uri("net.pipe://127.0.0.1/Example"));
NetNamedPipeBinding binding = new NetNamedPipeBinding();
ChannelFactory<IExampleService> factory = new ChannelFactory<IExampleService>(binding, address);
IExampleService exampleService = factory.CreateChannel();

Here is the stack on the client (the only clue in hand):

serverResponseWorker_DoWork System.TimeoutException: The open operation did not complete within the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout. 
at System.ServiceModel.Channels.PipeConnection.WaitForSyncRead(TimeSpan timeout, Boolean traceExceptionsAsErrors)
at System.ServiceModel.Channels.PipeConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
at System.ServiceModel.Channels.DelegatingConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionUpgradeHelper.InitiateUpgrade(StreamUpgradeInitiator upgradeInitiator, IConnection& connection, ClientFramingDecoder decoder, IDefaultCommunicationTimeouts defaultTimeouts, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
--- End of inner exception stack trace ---

Server stack trace: 
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

The server application continues running after the exception on the client and the server doesn't seem to throw any exceptions. Several details have been omitted, please ask if something else is needed.

What might be causing this? I'm pretty sure it's on the specific machine, otherwise we are really lucky to have this run in several hundred clients.

Odys
  • 8,951
  • 10
  • 69
  • 111
  • // IExampleService implementation --- what u r doing in this implementation? it is a 20 min process? – Vikram Bose Jun 06 '13 at 10:11
  • No, for sure! But since you are pointing that out, I'll check for circular dependencies in the process of the response. – Odys Jun 06 '13 at 10:33
  • @VikramBose I walk through code, the service just responds with data provided in its class, so there is no posibility that there is a deadlock. It only responds with string or numbers that are fields to it. So it is not possible that this is the root of the problem. Any suggestions? – Odys Jun 06 '13 at 11:50
  • see this link http://social.msdn.microsoft.com/forums/en-US/wcf/thread/6721cdf8-ceac-4cc3-98dc-17b092e872da – Vikram Bose Jun 06 '13 at 12:17
  • can you look for machine.config file in the particular machine for any special conditions. – Mullaly Jun 07 '13 at 05:44
  • @Mullaly what kind of conditions? – Odys Jun 07 '13 at 22:30
  • check out for the timeout conditions.. because you mention that the client runs in most of the other machines. – Mullaly Jun 10 '13 at 01:26

2 Answers2

1

Client didn't get a reponse form the server so, time out will occur

  • check the server side any Exception occur
Vikram Bose
  • 3,197
  • 2
  • 16
  • 33
  • Can you please elaborate on no2? – Odys Jun 06 '13 at 10:34
  • I dont know what is your implementation, implementation will be a retriving data from the database means dont take the whole data at the time, use paging(ex : your record size is 200000 each request take 1000 records). – Vikram Bose Jun 06 '13 at 10:58
0
       NetNamedPipeBinding binding = new NetNamedPipeBinding();
            CustomBinding pipeBinding = new CustomBinding(binding);
pipeBinding.Elements.Find<NamedPipeTransportBindingElement>().ConnectionPoolSettings.IdleTimeout = TimeSpan.MaxValue;
            binding.ReceiveTimeout = TimeSpan.MaxValue;

Just need to add time outs

Taj
  • 1,718
  • 1
  • 12
  • 16