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

Persistent clients and their HashTable should be destroyed in GSHUTDOWN

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 1.9.0
    • 1.10.0-alpha1, 1.10.0
    • None
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              jmikola@mongodb.com Jeremy Mikola
              jmikola@mongodb.com Jeremy Mikola
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: