-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 1.17.0
-
Component/s: None
-
None
In libmongoc 1.17.0, calls to mongoc_client_pool_destroy take roughly 500ms, or the default value for minHeartbeatFrequencyMS. In 1.16.2 this was near instantaneous.
I'm able to observe lower shutdown times by settingĀ MONGOC_TOPOLOGY_MIN_HEARTBEAT_FREQUENCY_MS to lower values, but the shutdown time is always at least what that value is set to.
This behavior seems buggy, though I imagine it could be an intended part of the streaming changes made for 4.4 servers like the other ticket I field.
On 1.17, the following prints about 0.5 seconds. On 1.16.2, it prints 0.00x seconds.
int main(int argc, char *argv[]) { const char *uri_string = "mongodb://localhost:27017/?retryReads=true"; mongoc_uri_t *uri; bson_error_t error; mongoc_init(); uri = mongoc_uri_new_with_error(uri_string, &error); if (!uri) { fprintf(stderr, "failed to parse URI: %s\n" "error message: %s\n", uri_string, error.message); return EXIT_FAILURE; } mongoc_client_pool_t *pool = mongoc_client_pool_new(uri); mongoc_client_t *client = mongoc_client_pool_pop(pool); mongoc_database_t *database = mongoc_client_get_database(client, "test"); mongoc_collection_t *collection = mongoc_database_get_collection(database, "blah"); mongoc_database_command_simple(database, BCON_NEW ("ping", BCON_INT32(1)), NULL, NULL, NULL); mongoc_client_pool_push(pool, client); struct timeval tv1, tv2; gettimeofday(&tv1, NULL); mongoc_client_pool_destroy(pool); gettimeofday(&tv2, NULL); printf ("Total time = %f seconds\n", (double) (tv2.tv_usec - tv1.tv_usec) / 1000000 + (double) (tv2.tv_sec - tv1.tv_sec)); return 0; }