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

Appended client metadata may be inadvertently applied to all future clients

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 1.8.0
    • Component/s: None
    • None

      Per mongoc-handshake.h, mongoc_handshake_data_append can only be called once per process. After the first call, the global handshake data is frozen and subsequent calls to the function return false. PHPC does not check the return value.

      This means that the first "driver" option in a Manager's $driverOptions seen by PHPC will apply to all future libmongoc clients and their handshakes for the lifetime of that PHP worker.

      I think I originally called attention to this in PHPC-1494; however, it didn't come up in the code review (mongodb/mongo-php-driver#1114). This also isn't discussed in the PHP.net documentation for the driver option, although I think it'd be a challenge to do so clearly.

      I don't believe this can be addressed without changes to libmongoc that would allow each client to specify its own handshake data (beyond appname), but I wanted to open this ticket so we can at least track the issue.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: