[CDRIVER-2931] _mongoc_client_set_apm_callbacks_private not called for mongoc_client_pool_try_pop Created: 23/Jan/19  Updated: 28/Oct/23  Resolved: 25/Jan/19

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: None
Fix Version/s: 1.14.0

Type: Bug Priority: Major - P3
Reporter: Jason Chan Assignee: Samantha Ritter (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Minor Change

 Description   

https://github.com/mongodb/mongo-c-driver/blob/1.13.0/src/libmongoc/src/mongoc/mongoc-client-pool.c#L212-L235

mongoc_client_pool_pop (mongoc_client_pool_t *pool)
{
   mongoc_client_t *client;
 
   ENTRY;
 
   BSON_ASSERT (pool);
 
   bson_mutex_lock (&pool->mutex);
 
again:
   if (!(client = (mongoc_client_t *) _mongoc_queue_pop_head (&pool->queue))) {
      if (pool->size < pool->max_pool_size) {
         client = _mongoc_client_new_from_uri (pool->topology);
 
         /* for tests */
         mongoc_client_set_stream_initiator (
            client,
            pool->topology->scanner->initiator,
            pool->topology->scanner->initiator_context);
 
         client->error_api_version = pool->error_api_version;
         _mongoc_client_set_apm_callbacks_private (
            client, &pool->apm_callbacks, pool->apm_context);

The above code is missing in mongoc_client_pool_try_pop: https://github.com/mongodb/mongo-c-driver/blob/1.13.0/src/libmongoc/src/mongoc/mongoc-client-pool.c#L256-L268

It seems to have been missed by: https://github.com/mongodb/mongo-c-driver/commit/e0eed4a2d1d72d99213db049488703b79a379e94



 Comments   
Comment by Githook User [ 31/Jan/19 ]

Author:

{'email': 'samantha.ritter@10gen.com', 'name': 'samantharitter'}

Message: CDRIVER-2931 initialize pop() and try_pop() pool clients the same way
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/b745141f06c9a2d90bdf0b7c4b0bc25003d9e389

Comment by Samantha Ritter (Inactive) [ 25/Jan/19 ]

Seems like the autobot didn't catch this commit!

https://github.com/mongodb/mongo-c-driver/commit/b745141f06c9a2d90bdf0b7c4b0bc25003d9e389

Comment by Kevin Albertson [ 23/Jan/19 ]

Hi jason.chan, thank you for the detailed bug report. I agree with your analysis. In addition, the error API version is not copied over either.

Generated at Wed Feb 07 21:16:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.