3 Replies Latest reply on May 15, 2012 3:22 PM by David Hearn

    PI AF Peculiar Error everyday between 12 PM to 3.30 PM (GMT+4)

    nagendra.saragadam

      Hi,

       

      I am getting below error when i am trying to get an AFObject using AFObject.FindObject method in AFSDK. I have debugged and found that the path what i am sending is correct. And this error is coming mostly in the afternoon from 12 to 3.30 PM (GMT +4 time zone). Can any one please help me with this.

       

      System.IndexOutOfRangeException: Index was outside the bounds of the array.
         at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
         at OSIsoft.AF.AFCollection`1.AddKey(Guid id, T item, Boolean inLoad) in c:\Builds\AF\AF 2.4\Sources\SDK\AFCollection.cs:line 3088
         at OSIsoft.AF.AFCollection`1.AddKey(T item, Boolean inLoad) in c:\Builds\AF\AF 2.4\Sources\SDK\AFCollection.cs:line 3245
         at OSIsoft.AF.AFNamedCollection`1.AddKey(T item, Boolean inLoad) in c:\Builds\AF\AF 2.4\Sources\SDK\AFCollection.cs:line 4135
         at OSIsoft.AF.AFCollection`1.InsertItem(List`1 list, Int32 index, T item, Int32 mode) in c:\Builds\AF\AF 2.4\Sources\SDK\AFCollection.cs:line 3439
         at OSIsoft.AF.Asset.AFElements.InsertItem(List`1 list, Int32 index, AFElement item, Int32 mode) in c:\Builds\AF\AF 2.4\Sources\SDK\Asset\AFElements.cs:line 1307
         at OSIsoft.AF.AFCollection`1.Load(Int32 page, Int32 numberToSkip, Boolean fullReload, Boolean fullUpdate, IdcObjectHeader[] headers) in c:\Builds\AF\AF 2.4\Sources\SDK\AFCollection.cs:line 2099
         at OSIsoft.AF.Asset.AFElements.LoadPage(String name, List`1& listPage) in c:\Builds\AF\AF 2.4\Sources\SDK\Asset\AFElements.cs:line 1017
         at OSIsoft.AF.AFNamedCollection`1.GetItemTyped(String name, Boolean returnDeletedItems, Boolean handlePathInName, Boolean inLoad) in c:\Builds\AF\AF 2.4\Sources\SDK\AFCollection.cs:line 4079
         at OSIsoft.AF.Asset.AFElements.GetItemTyped(String name, Boolean returnDeletedItems, Boolean handlePathInName, Boolean inLoad) in c:\Builds\AF\AF 2.4\Sources\SDK\Asset\AFElements.cs:line 1201
         at OSIsoft.AF.AFNamedCollection`1.GetItem(String name, Boolean returnDeletedItems, Boolean handlePathInName, Boolean inLoad) in c:\Builds\AF\AF 2.4\Sources\SDK\AFCollection.cs:line 4029
         at OSIsoft.AF.AFCollection`1.FindItemInCollection(AFCollection`1 items, AFParsedPathPart pathPart, AFObject relativeFrom, Boolean handlePathInName) in c:\Builds\AF\AF 2.4\Sources\SDK\AFCollection.cs:line 3880
         at OSIsoft.AF.Asset.AFElements.FindItemInCollection(AFParsedPathPart pathPart, AFObject relativeFrom, Boolean handlePathInName) in c:\Builds\AF\AF 2.4\Sources\SDK\Asset\AFElements.cs:line 1565
         at OSIsoft.AF.AFObject.FindChildObject(AFParsedPathPart pathPart, Boolean handlePathInName) in c:\Builds\AF\AF 2.4\Sources\SDK\AFObject.cs:line 3250
         at OSIsoft.AF.Support.AFParsedPath.ResolveSubObjectPath(AFParsedPath parsedPath, AFObject relativeFrom) in c:\Builds\AF\AF 2.4\Sources\SDK\Support\AFParsedPath.cs:line 1010
         at OSIsoft.AF.Support.AFParsedPath.ResolveSubObjectPath(AFParsedPath parsedPath, AFObject relativeFrom) in c:\Builds\AF\AF 2.4\Sources\SDK\Support\AFParsedPath.cs:line 1025
         at OSIsoft.AF.Support.AFParsedPath.ResolveObjectPath(AFParsedPath parsedPath, Boolean enableBulkLoad, String& parentPath, Int32& parentPathDepth) in c:\Builds\AF\AF 2.4\Sources\SDK\Support\AFParsedPath.cs:line 869
         at OSIsoft.AF.AFObject.FindObject(String path, AFObject relativeFrom, Nullable`1 queryDate) in c:\Builds\AF\AF 2.4\Sources\SDK\AFObject.cs:line 1144
         at OSIsoft.AF.AFObject.FindObject(String path) in c:\Builds\AF\AF 2.4\Sources\SDK\AFObject.cs:line 1110

       

      My Code is given below.

       
      myPISystems = new PISystems();
                      myPISystem = myPISystems[ConfigurationSettings.AppSettings["PISystem"].ToString()];
                      myDB = myPISystem.Databases[ConfigurationSettings.AppSettings["PIDatabase"].ToString()];
                      objectAF = AFObject.FindObject(@sElementPath);
                      // Null condition Added as there can be chance some Elements do not exist for certain well
                      if (objectAF != null)
                      {
      
                          oElement = (AFElement)objectAF;
                          if (oElement != null)
                          {
                              oAFAttrib = oElement.Attributes;
      

       

       

      Appreciate your help.

       

      Regarding,

       

      Nagendra.

        • Re: PI AF Peculiar Error everyday between 12 PM to 3.30 PM (GMT+4)
          hanyong

          Hi Nagendra,

           

          I don't think this is a problem that is coming from your code, probably more troubleshooting is required. Off my head, I have the following questions

          1. Is this error occurring on a specific machine or it happens in other machines running the same program?
          2. Is the program running on a seperate machine from the AF server?
          3. You mentioned that the error mostly occurs from 12 to 3:30pm, does it mean you will not get error outside of the time range? or it does happen, just not as often?
          4. Since you identified a range of time that you are likely to get the error, would it be the same if you manually change the time settings on the machine to the time?
            • Re: PI AF Peculiar Error everyday between 12 PM to 3.30 PM (GMT+4)
              nagendra.saragadam

              Hi Han Yong,

               

              Han Yong Lee

              Is this error occurring on a specific machine or it happens in other machines running the same program?
              We have a sharepoint + silverlight website which talks to WCF service on a web server. This WCF has got the above code to fetch the AFAttribute values. Recently we migrated these applications from Sharepoint 2007 to 2010 in a new server with a New AF Server configured. I am getting this error in the new environment. Old server and applications are running fine.

               

              Han Yong Lee

              Is the program running on a seperate machine from the AF server?
              Yes, the WCF which is accessing AF is running on other server.

               

              Han Yong Lee

              You mentioned that the error mostly occurs from 12 to 3:30pm, does it mean you will not get error outside of the time range? or it does happen, just not as often?
              Yes, outside this time range it will not happen. To be frank i found this error mostly after 12pm when i access application and may vanish before 3.30pm and some times before 2 and some times before 3.30. This is happening everyday.

               

              Han Yong Lee

              Since you identified a range of time that you are likely to get the error, would it be the same if you manually change the time settings on the machine to the time?
              We haven't tried this as the systems where we are working are production servers and we dont have any dev's.

               

               

               

              I hope this could be a problem with the AF versions.

               

              Old Server - AF 2010 R2 (2.1.0.3522) AFSDK - 2.3.1.4095

               

              New Server - AF 2010 R3 (2.4.0.4431) AFSDK - 2.4.0.4431

               

              Hope this information helps.

                • Re: PI AF Peculiar Error everyday between 12 PM to 3.30 PM (GMT+4)
                  David Hearn

                  The exception is being thrown when inserting a reference to the element being loaded from the server into a standard .NET Dictionary where the element's ID is the dictionary's key.

                   

                  Since you are running in a web server, this will be a multi-threaded application. Is it possible that you have another application that is running during the times you see the error that is also accessing the web service? If so, it trying to load the same page of elements or maybe removing an element. You may need to put a lock around sections of code to prevent the possibility of modifying the elements collection from multiple threads.