Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-1722

Persistent clients and their HashTable should be destroyed in GSHUTDOWN

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.10.0-alpha1, 1.10.0
    • Affects Version/s: 1.9.0
    • Component/s: 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:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: