none
.NET 4.0 Remoting IPC Channel Hang-up RRS feed

  • Question

  • Hi,

    I am using legacy .NET remoting in my server-client application (SAO). After some time, my client connection hangs-up and never reach the server. There are at least two client connections in my server and both hang-up almost at the same time. here is the stack trace of one of the client. One client sends data to the server and the other gets data from the server. The getter client is the most expensive in terms of CPU processing asking data almost every other 5-10 (or less) milliseconds depending how fast the server responds. The sender client sends data at a 2-3 seconds frequency.  

    OS Thread Id: 0x9b0 (11)
    Child SP IP       Call Site
    06ade95c 771b5cd4 [InlinedCallFrame: 06ade95c]
    
    06ade958 6c96c932 DomainBoundILStubClass.IL_STUB_PInvoke(System.Runtime.Remoting.Channels.Ipc.PipeHandle, Byte*, Int32, Int32 ByRef, IntPtr)
    06ade95c 6c96b841 [InlinedCallFrame: 06ade95c] System.Runtime.Remoting.Channels.Ipc.NativePipe.ReadFile(System.Runtime.Remoting.Channels.Ipc.PipeHandle, Byte*, Int32, Int32 ByRef,
     IntPtr)
    06ade9b0 6c96b841 System.Runtime.Remoting.Channels.Ipc.IpcPort.Read(Byte[], Int32, Int32)
    06ade9d8 6c96c19e System.Runtime.Remoting.Channels.Ipc.PipeStream.Read(Byte[], Int32, Int32)
    06ade9f0 6c961017 System.Runtime.Remoting.Channels.SocketHandler.ReadFromSocket(Byte[], Int32, Int32)
    06adea04 6c9610c8 System.Runtime.Remoting.Channels.SocketHandler.Read(Byte[], Int32, Int32)
    06adea28 6c961147 System.Runtime.Remoting.Channels.SocketHandler.ReadAndMatchFourBytes(Byte[])
    06adea38 6c9696b3 System.Runtime.Remoting.Channels.Tcp.TcpSocketHandler.ReadAndMatchPreamble()
    06adea44 6c9695db System.Runtime.Remoting.Channels.Tcp.TcpSocketHandler.ReadVersionAndOperation(UInt16 ByRef)
    06adea70 6c9901ca System.Runtime.Remoting.Channels.Ipc.IpcClientHandler.ReadHeaders()
    06adea8c 6c98f6a0 System.Runtime.Remoting.Channels.Ipc.IpcClientTransportSink.ProcessMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Channels.ITransportHeaders,
     System.IO.Stream, System.Runtime.Remoting.Channels.ITransportHeaders ByRef, System.IO.Stream ByRef)
    06adeab8 6c96dd3c System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage)
    06adeaf4 705971d4 System.Runtime.Remoting.Proxies.RemotingProxy.CallProcessMessage(System.Runtime.Remoting.Messaging.IMessageSink, System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Contexts.ArrayWithSize,
     System.Threading.Thread, System.Runtime.Remoting.Contexts.Context, Boolean)
    06adeb18 70597141 System.Runtime.Remoting.Proxies.RemotingProxy.InternalInvoke(System.Runtime.Remoting.Messaging.IMethodCallMessage, Boolean, Int32)
    06adeb70 70596f5e System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(System.Runtime.Remoting.Messaging.IMessage)
    06adeb84 705f2ade System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(System.Runtime.Remoting.Proxies.MessageData ByRef, Int32)
    06adee14 71f22336 [TPMethodFrame: 06adee14] Connection.Interfaces.IEncrypt.getPublicKey(Int32 ByRef)
    06adee24 00a687f8 Connection.Proxy._openSession()
    06adee58 00a6868a Connection.Proxy._openSession(Connection.SessionType, System.String, System.String, System.String, System.Object[])
    06adee94 00a68626 Connection.AdminProxy._openSession(System.String, System.String, System.String)
    06adef0c 6fc3bfcc System.Timers.Timer.MyTimerCallback(System.Object)*** WARNING: Unable to verify checksum for System.ni.dll
    
    06adef44 705ecd67 System.Threading._TimerCallback.TimerCallback_Context(System.Object)
    06adef4c 705b7fd4 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
    06adef70 705eccac System.Threading._TimerCallback.PerformTimerCallback(System.Object)
    06adf144 71f221bb [GCFrame: 06adf144]
    
    06adf24c 71f221bb [DebuggerU2MCatchHandlerFrame: 06adf24c]
    
    

    I found in the code implementation that there is no timeout when the client channel is activated/created. 

    BinaryServerFormatterSinkProvider binaryServerProvider = new BinaryServerFormatterSinkProvider();
    AssignTypeFilterLevelFull(binaryServerProvider);
    
    BinaryClientFormatterSinkProvider binaryClientProvider = new BinaryClientFormatterSinkProvider();
    
    
    IDictionary channelProperties = new Hashtable();
    
    channelProperties["name"] = name;
    channelProperties["priority"] = priority.ToString();
    
    if (isLocal)
    {
    	channelProperties["portName"] = port.ToString();
    	channelProperties["exclusiveAddressUse"] = false;
    	channelProperties["authorizedGroup"] = AdminUserGroup ;
    	channel = new IpcChannel(channelProperties, binaryClientProvider, binaryServerProvider);
    }
    else
    {
    	channelProperties["port"] = (int)port;
    	channelProperties["machineName"] = System.Environment.MachineName;
    	channel = new TcpChannel(channelProperties, binaryClientProvider, binaryServerProvider);
    }
    
    ChannelServices.RegisterChannel(channel, false);

    My plan is to add a timeout property for the IPC and the TCP (connectionTimeout and timeout, respectively). something like below.

    channelProperties["connectionTimeout"] = TimeoutInMS;

    channelProperties["timeout"] = TimeoutInMS;


    But just given the stack trace above, is this `timeout` guaranteed to work? I haven't really tested this because the bug seems to occur to customers but never on our replication machines. 

    NOTE that the system work for days without problem and it just hangs-up after some time (maybe days or weeks)

    Thanks in advance. :)


    • Edited by junPac Tuesday, October 14, 2014 12:54 AM call stack
    Tuesday, October 14, 2014 12:53 AM

Answers

  • I think I will just create a small .NET Remoting TCP/IPC App and try the timeout stuff first before adding the timeout property on our code. This would solve my question if the timeout is guaranteed to work. 

    Nevertheless, thanks @darnold924 for checking out this discussion.

    Regards.

    Wednesday, October 15, 2014 9:12 AM

All replies

  • PS. please do note that when both clients hang-up, it hangs forever until the machine where the application resides is restarted, given that there are currently no implementation of timeout. Please advise. 

    Thanks


    • Edited by junPac Tuesday, October 14, 2014 2:04 AM emphasis
    Tuesday, October 14, 2014 2:02 AM
  • After all, you said that you are using .NET remoting (legacy). Maybe, you should consider using WCF over TCP/IP, since .NET remoting is being depreciated, And beside, this is a WCF forum.
    Tuesday, October 14, 2014 3:36 AM
  • I think I missed the part where I need to select the right forum. Is there a way to change that? Otherwise, I will create a new thread under .NET remoting.
    Tuesday, October 14, 2014 8:44 AM
  • I think I missed the part where I need to select the right forum. Is there a way to change that? Otherwise, I will create a new thread under .NET remoting.

    The MSDN .NET Remoting forum seems to have died back in 2012. Why it's still around,who knows?  Maybe it has some kind of historical value.

    Tuesday, October 14, 2014 10:00 AM
  • I think I will just create a small .NET Remoting TCP/IPC App and try the timeout stuff first before adding the timeout property on our code. This would solve my question if the timeout is guaranteed to work. 

    Nevertheless, thanks @darnold924 for checking out this discussion.

    Regards.

    Wednesday, October 15, 2014 9:12 AM