Persistent clients and their HashTable should be destroyed in GSHUTDOWN

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 1.10.0-alpha1, 1.10.0
    • Affects Version/s: 1.9.0
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Came across this while implementing disablePersistentClient for PHPC-1645.

      The internal HashTable for tracking persistent clients is initialized in GINIT; however, we free its clients and destroy the HashTable in MSHUTDOWN. This makes no difference for single-threaded PHP deployments (e.g. CLI, FPM), since GINIT and GSHUTDOWN are invoked once from MINIT and MSHUTDOWN, respectively; however, it could pose problems for threaded SAPIs (despite those being discouraged).

      Since libmongoc clients should not be shared among threads, it does make sense to initialize the HashTable in GINIT and we should just ensure that the HashTable is destroyed during GSHUTDOWN to avoid potential leaks.

              Assignee:
              Jeremy Mikola
              Reporter:
              Jeremy Mikola
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: