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

phongo_execute_query() should not alter state of Query opts

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • 1.5.3
    • Affects Version/s: 1.4.0
    • Component/s: None
    • Labels:
      None

      Currently, phongo_execute_query() may permanently alter a Query object's bson_t opts when calling phongo_parse_session() (which can append a "sessionId") or appending a "serverId". If the same Query is executed multiple times, duplicate "sessionId" and "serverId" fields might be appended. Furthermore, if a Query is shared between different Managers (possibly libmongoc clients), we could end up using a server ID with a completely different topology.

      This was responsible for some failures in the Atlas connectivity tests on Travis (see: build log).

      This likely dates back to 1.4.0 when session options were introduced in PHPC-1042. A more recent change where we moved to appending "serverId" to query->opts occurred in b29c423.

      This bug may also have been responsible for some outstanding issues with unknown sessions or closed cursors, although determination of that would depend on debugging the internal state of Query objects (to see if duplicate fields were appended to options) for users experiencing such errors.

      Note: this is not an issue for executing commands (no state is altered) or bulk writes (cannot be executed multiple times).

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

              Created:
              Updated:
              Resolved: