1 Reply Latest reply on Aug 10, 2016 3:06 PM by Roger Palmen

    PIDataPipe: how to gracefully close?

    Roger Palmen

      Hi all,

      In PIDataPipe GetObserverEvents: how often to call? i work on processing a large datapipe with lots of PI Points. Now it seems (i have limited data on the PI Data Archive) that after i close the datapipe, the data is still added to the queue, leading to overflows.I always get a spike in lost events after i close my pipe. It appears the 10-minute wait after closing the datapipe is to blame, as is mentioned here:Handling Errors returned by GetObserverEvents() method of a AFDataPipe

       

      I close the pipe as follows:

                      piPipe.Close();
                      piPipe.Dispose();
                      piserver.Disconnect();
      

       

      Any ideas how to prevent this behaviour? Remove all signups before i close the pipe?

      piPipe.RemoveSignups(piPipe.AsReadOnly()); 
      
        • Re: PIDataPipe: how to gracefully close?
          Roger Palmen

          Did some first testing, and indeed i can see a spike in Lost events. As soon as i close my eventpipe, the Queue shoots to tuning parameter MaxUpdateQueue as i stopped reading the queue, and lost events peak to the MaxUpdateQueue level (100K). Some time later the queue seems to have been removed, the queued events drops with 100K and Lost Events is stable.

           

          Rerunning the test but removing the signups waaaay before i close my pipe seems to resolve the issue and the updates lost counter does not spike. Oddly enough the Queued updates counter still peaks at 100K for 30 odd seconds until that drops back to 0. My hunch is that this is related to the producer and consumer not being in sync all the time on what should be queued. After closing the pipe, the Consumer is almost immediately removed from the Consumers list.

           

          So that solved my own issue. There is some improvement to be made here, at least in documentation, on what to do with the pipes on close. Preferrably the AFSDK does a graceful close if i call the close method on the pipe.