@@ -2312,6 +2312,37 @@ test_ssl_pooled (void)
2312
2312
{
2313
2313
_test_mongoc_client_ssl_opts (true);
2314
2314
}
2315
+
2316
+ static void
2317
+ test_client_buildinfo_hang (void )
2318
+ {
2319
+ mongoc_client_pool_t * pool ;
2320
+ mongoc_client_t * client ;
2321
+ mongoc_database_t * database ;
2322
+ bson_error_t error ;
2323
+ bson_t command ;
2324
+ bson_t reply ;
2325
+
2326
+ pool = test_framework_client_pool_new ();
2327
+ BSON_ASSERT (pool );
2328
+ client = mongoc_client_pool_pop (pool );
2329
+
2330
+ database = mongoc_client_get_database (client , "admin" );
2331
+ bson_init (& command );
2332
+ bson_append_int32 (& command , "buildInfo" , -1 , 1 );
2333
+
2334
+ /* Prior to a bug fix this command caused a hang - see CDRIVER-3318 */
2335
+ ASSERT_OR_PRINT (
2336
+ mongoc_database_command_simple (database , & command , NULL , & reply , & error ),
2337
+ error );
2338
+
2339
+ bson_destroy (& command );
2340
+ bson_destroy (& reply );
2341
+ mongoc_database_destroy (database );
2342
+ mongoc_client_destroy (client );
2343
+ mongoc_client_pool_destroy (pool );
2344
+ }
2345
+
2315
2346
#else
2316
2347
/* MONGOC_ENABLE_SSL is not defined */
2317
2348
static void
@@ -3842,6 +3873,9 @@ test_client_install (TestSuite *suite)
3842
3873
suite , "/Client/ssl/reconnect/single" , test_ssl_reconnect_single );
3843
3874
TestSuite_AddMockServerTest (
3844
3875
suite , "/Client/ssl/reconnect/pooled" , test_ssl_reconnect_pooled );
3876
+
3877
+ TestSuite_AddLive (suite , "/Client/ssl_hang" , test_client_buildinfo_hang );
3878
+
3845
3879
#endif
3846
3880
#else
3847
3881
/* No SSL support at all */
0 commit comments