@@ -48,7 +48,8 @@ static PHP_METHOD(Server, executeCommand)
4848 options = php_phongo_prep_legacy_option (options , "readPreference" , & free_options TSRMLS_CC );
4949
5050 /* If the Server was created in a different process, reset the client so
51- * that cursors created by this process can be differentiated. */
51+ * that cursors created by this process can be differentiated and its
52+ * session pool is cleared. */
5253 PHONGO_RESET_CLIENT_IF_PID_DIFFERS (intern );
5354
5455 phongo_execute_command (intern -> client , PHONGO_COMMAND_RAW , db , command , options , intern -> server_id , return_value , return_value_used TSRMLS_CC );
@@ -76,7 +77,8 @@ static PHP_METHOD(Server, executeReadCommand)
7677 }
7778
7879 /* If the Server was created in a different process, reset the client so
79- * that cursors created by this process can be differentiated. */
80+ * that cursors created by this process can be differentiated and its
81+ * session pool is cleared. */
8082 PHONGO_RESET_CLIENT_IF_PID_DIFFERS (intern );
8183
8284 phongo_execute_command (intern -> client , PHONGO_COMMAND_READ , db , command , options , intern -> server_id , return_value , return_value_used TSRMLS_CC );
@@ -100,7 +102,8 @@ static PHP_METHOD(Server, executeWriteCommand)
100102 }
101103
102104 /* If the Server was created in a different process, reset the client so
103- * that cursors created by this process can be differentiated. */
105+ * that cursors created by this process can be differentiated. and its
106+ * session pool is cleared. */
104107 PHONGO_RESET_CLIENT_IF_PID_DIFFERS (intern );
105108
106109 phongo_execute_command (intern -> client , PHONGO_COMMAND_WRITE , db , command , options , intern -> server_id , return_value , return_value_used TSRMLS_CC );
@@ -124,7 +127,8 @@ static PHP_METHOD(Server, executeReadWriteCommand)
124127 }
125128
126129 /* If the Server was created in a different process, reset the client so
127- * that cursors created by this process can be differentiated. */
130+ * that cursors created by this process can be differentiated and its
131+ * session pool is cleared. */
128132 PHONGO_RESET_CLIENT_IF_PID_DIFFERS (intern );
129133
130134 phongo_execute_command (intern -> client , PHONGO_COMMAND_READ_WRITE , db , command , options , intern -> server_id , return_value , return_value_used TSRMLS_CC );
@@ -151,7 +155,8 @@ static PHP_METHOD(Server, executeQuery)
151155 options = php_phongo_prep_legacy_option (options , "readPreference" , & free_options TSRMLS_CC );
152156
153157 /* If the Server was created in a different process, reset the client so
154- * that cursors created by this process can be differentiated. */
158+ * that cursors created by this process can be differentiated and its
159+ * session pool is cleared. */
155160 PHONGO_RESET_CLIENT_IF_PID_DIFFERS (intern );
156161
157162 phongo_execute_query (intern -> client , namespace , query , options , intern -> server_id , return_value , return_value_used TSRMLS_CC );
@@ -185,6 +190,10 @@ static PHP_METHOD(Server, executeBulkWrite)
185190
186191 options = php_phongo_prep_legacy_option (options , "writeConcern" , & free_options TSRMLS_CC );
187192
193+ /* If the Server was created in a different process, reset the client so
194+ * that its session pool is cleared. */
195+ PHONGO_RESET_CLIENT_IF_PID_DIFFERS (intern );
196+
188197 phongo_execute_bulk_write (intern -> client , namespace , bulk , options , intern -> server_id , return_value , return_value_used TSRMLS_CC );
189198
190199 if (free_options ) {
0 commit comments