locked
"Failed to write to an IPC Port: The pipe is being closed." after inactivity period

    Question

  • Hello all,

    I'm working on a remoting application that uses IPC channels. The server side exposes several interfaces whose methods return objects that extend the MarshalByRefObject class. Therefore, the client operates almost all the time invoking remote methods on these objects.

    The problem starts when the client application is idle for some time: after aproximatelly 5 minutes, the next remoting call results in the exception "Failed to write to an IPC Port: The pipe is being closed.". If I restart the client application, remoting connections are reestablished correctly until the next idle period.

    I would say that the server is cleaning resources during the idle period, what makes the client crash when trying to use resources that are no longer available. I have taken a look at client channel properties (http://msdn.microsoft.com/en-us/library/bb187436(VS.80).aspx) and server channel properties (http://msdn.microsoft.com/en-us/library/bb187433(VS.80).aspx) but didn't find anything.

    Does anyone have any idea on how to avoid this problem?

    Thanks in advance,

    Guillermo

    Tuesday, May 19, 2009 4:21 PM

Answers

All replies

  • I think you might be running into a channel-level inactivity timeout, which could be fixed by explicitly specifying an increased value for the client-side "connectiontimeout" property. Does the approach previously discussed on this thread help?


    Brain.Save() -- http://hyperthink.net/blog

    Wednesday, May 27, 2009 1:12 AM
  • Thanks for the link, I'll implement what's suggested in that thread and report back.

    Kind regards,

    Guillermo
    Wednesday, May 27, 2009 12:44 PM
  • I know this thread is a little old, but I'm having the same problem.  Are you sure that this is the correct answer?  This is the description of the ConnectionTimeout property from MSDN:  

    An integer that specifies the number of milliseconds to wait for a successful connection. 0 or -1 indicates an infinite timeout period. The default is Infinite.

    Sounds very different to an inactivity timeout.  

    Besides, I haven't specified a value for ConnectionTimeout, so therefore it's set to infinite, and still I occasionally get an error that says "Failed to write to an IPC port: The Pipe is being closed". Does anyone know how I can ensure the IPC channel stays alive for lifetime of the application?




    • Edited by DominicGee Wednesday, October 10, 2012 1:54 PM
    Wednesday, October 10, 2012 1:53 PM