Uploaded image for project: 'HPCC'
  1. HPCC
  2. HPCC-22177

environment caching code could be improved and close potential problems iterating while environment changing

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: New
    • Priority: Not specified
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Core Libraries
    • Labels:
      None

      Description

      The code in environment.cpp that caches component information, and then returns iterators for various types of objects in the cache could hit problems if the cache is updated (and cleared) whilst an iterator is being walked.

      See any of the ByIndex(..) methods in environment.

      I think there may also be related issues when looking up a single item due to the way the returned item references the dali info without cloning it (or fetching it all) meaning it could become stale before used.

      Comment from related JIRA (HPCC-21959):

      there's slight issue to this and all the other similar iterators..
      If the environment updates whilst iterating, then the results will be indeterminate.

      Not something to tackle now, but I suspect the way this should work, is to gather them into lists, once (e.g. on 1st request) - then the contents of the list at iterator construction time, so underlying list can be rebuild if env. changes without effecting the iterator.

      It would also be more efficient this way, as generally doesn't change often and it wouldn't have to be recreating an environment factory/openEnvironment etc., every time an interator was required.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                attilavamos Attila Vamos
                Reporter:
                jakesmith Jake Smith
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: