File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,12 @@ def do_work
111111 @topology_version = new_description . topology_version
112112 end
113113 rescue Mongo ::Error => exc
114+ stop_requested = @lock . synchronize { @stop_requested }
115+ if stop_requested
116+ # Ignore the exception, see RUBY-2771.
117+ return
118+ end
119+
114120 msg = "Error running awaited hello on #{ server . address } "
115121 Utils . warn_bg_exception ( msg , exc ,
116122 logger : options [ :logger ] ,
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+ # encoding: utf-8
3+
4+ require 'spec_helper'
5+
6+ # This test repeatedly creates and closes clients across several threads.
7+ # Its goal is to ensure that the push monitor connections specifically get
8+ # closed without any errors or warnings being reported to applications.
9+ #
10+ # Although the test is specifically meant to test 4.4+ servers (that utilize
11+ # the push monitor) in non-LB connections, run it everywhere for good measure.
12+ describe 'Push monitor close test' do
13+ require_stress
14+
15+ let ( :options ) do
16+ SpecConfig . instance . all_test_options
17+ end
18+
19+ before ( :all ) do
20+ # load if necessary
21+ ClusterConfig . instance . primary_address
22+ ClientRegistry . instance . close_all_clients
23+ end
24+
25+ it 'does not warn/error on cleanup' do
26+ Mongo ::Logger . logger . should_not receive ( :warn )
27+
28+ threads = 10 . times . map do
29+ Thread . new do
30+ 10 . times do
31+ client = new_local_client ( [ ClusterConfig . instance . primary_address . seed ] , options )
32+ if rand > 0.33
33+ client . command ( ping : 1 )
34+ sleep ( rand * 3 )
35+ end
36+ client . close
37+ STDOUT << '.'
38+ end
39+ end
40+ end
41+ threads . each ( &:join )
42+ puts
43+ end
44+ end
You can’t perform that action at this time.
0 commit comments