none
Mysterious => There was an error reading from the pipe: The pipe has been ended. (109, 0x6d). RRS feed

  • Question

  • Hi All, I know there are million Posts on this exception here but I don't Understand this one here. 

    I have an extrem simple pipe Service =>

    [ServiceContract]
    public interface ISRARiskExport
    { 
    [OperationContract(IsOneWay = true)]
    void RiskExport(long sraid, long revID, string JobID);
    }

    And when I call it ones everything is fine but when two clients call it at the same time it throws this exception.

    => There was an error reading from the pipe: The pipe has been ended. (109, 0x6d).

    The Server code direktly setup a new thread and returns to the client.

    public void RiskExport(long sraid, long revID, string JobID)
    {
    ThreadStarter starter = new ThreadStarter(new ThreadStartWithParameter(RunExportJob), new SRAInfo() { sraid = sraid, revID = revID, JobID = JobID });
    Thread t = new Thread(new System.Threading.ThreadStart(starter.ThreadStartEntry));
    t.IsBackground = true;
    t.Start();
    }

    So therefor it can’t be a timeout problem, because it takes les then 1 sec from cleint to server and back. Especially when I call it synchronously in for loop from my unit test

    string JobID = "";
    for (int i = 0; i < 100; i++)
    {
    string baseAddress = "net.pipe://localhost/SRADocumentService";
    ChannelFactory<ISRARiskExport> factory = new ChannelFactory<ISRARiskExport>(new NetNamedPipeBinding(NetNamedPipeSecurityMode.None), new EndpointAddress(baseAddress));
    ISRARiskExport svc = factory.CreateChannel();
    JobID = Guid.NewGuid().ToString();
    svc.RiskExport(sraid, revID, JobID);
    }

    I all ready activated the WCF trace. Here I can see that the Exception Is thrown by each call. The Detail pane doesn’t help me at all, because it one shows me the Exception twice =>

    There was an error reading from the pipe: The pipe has been ended. (109, 0x6d).



    With different Stack traces =>

    I also see in the Debugview that the Exceptions come long after the call is back at the client.

    My Questions are:

    1. Why is the Service working as expectet even when it is throwing this Exception
    2. How can I get rid of the Exception because they all get to the log file and I’m not abel to catch it.

     

    THX Michael





    Wednesday, August 3, 2016 2:27 PM

All replies

  • Hi Michael,

    >> There was an error reading from the pipe: The pipe has been ended. (109, 0x6d).

    Did you get this exception in client side or service tracing? To check whether it is related with function in RiskExport, I suggest you replace the code with a simple function like “Console.WriteLine(“Hello World”);”.

    >> all ready activated the WCF trace. Here I can see that the Exception Is thrown by each call
    Do you mean if you send one request, it still produce this exception in the Trace? Could you share us your config file in server side and client side?

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, August 4, 2016 10:47 AM
  • Hi Edward,

    In my Service I have no Config atall. I use only default. I also tested to return direktly back without doing anything on server side =>

            public void RiskExport(long sraid, long revID, string JobID)
            {
                return;

    Exception is still in the Logfile.

    2016-08-05 09:39:48.568  ServiceModel   Error          System.ServiceModel.CommunicationException: There was an error reading from the pipe: The pipe has been ended. (109, 0x6d). ---> System.IO.PipeException: There was an error reading from the pipe: The pipe has been ended. (109, 0x6d).
       at System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean haveResult, Int32 error, Int32 numBytes)
       --- End of inner exception stack trace ---
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.TransportDuplexSessionChannel.EndTryReceive(IAsyncResult result, Message& message)
       at System.ServiceModel.Dispatcher.DuplexChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
       at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
    2016-08-05 09:39:48.590  ServiceModel   Error          System.ServiceModel.CommunicationException: There was an error reading from the pipe: The pipe has been ended. (109, 0x6d). ---> System.IO.PipeException: There was an error reading from the pipe: The pipe has been ended. (109, 0x6d).
       at System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean haveResult, Int32 error, Int32 numBytes)
       --- End of inner exception stack trace ---
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.TransportDuplexSessionChannel.EndTryReceive(IAsyncResult result, Message& message)
       at System.ServiceModel.Dispatcher.DuplexChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
       at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
    2016-08-05 09:39:48.591  ServiceModel   Error          System.ServiceModel.CommunicationException: There was an error reading from the pipe: The pipe has been ended. (109, 0x6d). ---> System.IO.PipeException: There was an error reading from the pipe: The pipe has been ended. (109, 0x6d).
       at System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean haveResult, Int32 error, Int32 numBytes)
       --- End of inner exception stack trace ---
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.TransportDuplexSessionChannel.EndTryReceive(IAsyncResult result, Message& message)
       at System.ServiceModel.Dispatcher.DuplexChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
       at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
    

    Client Code

                for (int i = 0; i < 100; i++)
                {
    
                string baseAddress = "net.pipe://localhost/SRADocumentService";
                ChannelFactory<ISRARiskExport> factory = new ChannelFactory<ISRARiskExport>(new NetNamedPipeBinding(NetNamedPipeSecurityMode.None), new EndpointAddress(baseAddress));
                
                ISRARiskExport svc = factory.CreateChannel();
                
                JobID = Guid.NewGuid().ToString();
                svc.RiskExport(sraid, revID, JobID);
    
                }

    Server Code

            public void RiskExport(long sraid, long revID, string JobID)
            {
                ThreadStarter starter = new ThreadStarter(new ThreadStartWithParameter(RunExportJob), new SRAInfo() { sraid = sraid, revID = revID, JobID = JobID });
                Thread t = new Thread(new System.Threading.ThreadStart(starter.ThreadStartEntry));
                t.IsBackground = true;
                t.Start();
            }







    Regards



    Friday, August 5, 2016 8:13 AM
  • Hi Michael,

    I made a test with NetNamedPipeBinding, and it seems I could reproduce your issue. The service works correctly, but there is some errors in tracing. I will keep looking into this issue, and I will come back asap if I find the issue.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, August 8, 2016 11:24 AM
  • Hi Edward,

    were you able to fine a solution for this?

    Regards

    Michael


    MK

    Wednesday, August 24, 2016 6:43 AM
  • Why don't you close the channel and factory when no longer needed?

    I never used it so this my best guess:

    Now the garbage collector probably just closes the namedpipe without properly informing the server of ending the connection. So the server throw most likely a exception on the unexpected close.

    Wednesday, August 24, 2016 7:09 AM
  • Michael,

    Did you ever find answer to your problem? I have exactly the same problem and could not figure out the answer.

    Thanks,

    Paul

    Saturday, June 20, 2020 7:56 AM