mongo 2.21.1 → 2.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 047b2bd74446fc71cfe815c1610d47608078301092f8bbd29c0819f85fb1ed3c
4
- data.tar.gz: 931d7cf1753c4bcdfc66a8d25867b591daa3027d653488dfe28023a55dc4f378
3
+ metadata.gz: 581c10bfc119dd624b9c29d9471e7697ed7ece568cc7023c2a4894b9e430e58e
4
+ data.tar.gz: 634e8d69003d43838f47999e13d5677492cfd7ea396cec02907c17c734709024
5
5
  SHA512:
6
- metadata.gz: 843f969dc849f53be7531c3cc7cf0f2f0100b383eadf442709fbfa10aad89b56940c60351b06f68f9a08bf76896889bbb752d6d1dbfdef854dd2eccb673c93cf
7
- data.tar.gz: 7568cad4a519464cffd3953f9183c4cf85d1fe9c4818e18bbefc9c5b82ec91f76ea228a51bd760a3be5f98e92275628452e65b96fe3d5f4b1f3f0435ab9ecdea
6
+ metadata.gz: a58d9b653904b7c399be80f414551b00228b97078811e31c3d623ea924596510a39702c22e4830d166984326b8494d723f7e35cf6dfabbc8f06a0d30ff780c99
7
+ data.tar.gz: 11d1adcea0991ec8adca191c4015dc6914622e6bf5753046a8b0ad24cdf5de138329a702b522ba54d474dd03b18a983722827b112825b5602101e550cdd3754c
data/README.md CHANGED
@@ -121,11 +121,13 @@ their applications.
121
121
  Please refer to [spec/README.md](https://github.com/mongodb/mongo-ruby-driver/blob/master/spec/README.md) for instructions on how
122
122
  to run the driver's test suite.
123
123
 
124
- ## Release History
124
+ ## Releases
125
125
 
126
126
  Full release notes and release history are available [on the GitHub releases
127
127
  page](https://github.com/mongodb/mongo-ruby-driver/releases).
128
128
 
129
+ The MongoDB Ruby driver follows [semantic versioning](https://semver.org/) for its releases.
130
+
129
131
  ## License
130
132
 
131
133
  Copyright (C) 2009-2020 MongoDB, Inc.
@@ -47,13 +47,15 @@ module Mongo
47
47
  end
48
48
 
49
49
  def pipe_fds(service_id: nil)
50
- @pipe_fds[service_id][@map[service_id]]
50
+ @pipe_fds.dig(service_id, @map[service_id])
51
51
  end
52
52
 
53
53
  def remove_pipe_fds(generation, service_id: nil)
54
54
  validate_service_id!(service_id)
55
55
 
56
56
  r, w = @pipe_fds[service_id].delete(generation)
57
+ return unless r && w
58
+
57
59
  w.close
58
60
  # Schedule the read end of the pipe to be closed. We cannot close it
59
61
  # immediately since we need to wait for any Kernel#select calls to
@@ -89,8 +91,31 @@ module Mongo
89
91
  end
90
92
  end
91
93
 
94
+ # Close all pipes in the generation manager.
95
+ #
96
+ # This method should be called only when the +ConnectionPool+ that
97
+ # owns this +GenerationManager+ is closed, to ensure that all
98
+ # pipes are closed properly.
99
+ def close_all_pipes
100
+ @lock.synchronize do
101
+ close_all_scheduled
102
+ @pipe_fds.keys.each do |service_id|
103
+ generations = @pipe_fds.delete(service_id)
104
+ generations.values.each do |(r, w)|
105
+ r.close
106
+ w.close
107
+ rescue IOError
108
+ # Ignore any IOError that occurs when closing the
109
+ # pipe, as there is nothing we can do about it.
110
+ end
111
+ end
112
+ end
113
+ end
114
+
115
+
92
116
  private
93
117
 
118
+
94
119
  def validate_service_id!(service_id)
95
120
  if service_id
96
121
  unless server.load_balancer?
@@ -671,6 +671,7 @@ module Mongo
671
671
 
672
672
  @max_connecting_cv.broadcast
673
673
  @size_cv.broadcast
674
+ @generation_manager.close_all_pipes
674
675
  end
675
676
 
676
677
  publish_cmap_event(
data/lib/mongo/socket.rb CHANGED
@@ -64,6 +64,9 @@ module Mongo
64
64
  # connection (for non-monitoring connections) that created this socket.
65
65
  # @option options [ true | false ] :monitor Whether this socket was
66
66
  # created by a monitoring connection.
67
+ # @option options :pipe [ IO ] The file descriptor for the read end of the
68
+ # pipe to listen on during the select system call when reading from the
69
+ # socket.
67
70
  #
68
71
  # @api private
69
72
  def initialize(timeout, options)
@@ -106,6 +109,13 @@ module Mongo
106
109
  !!options[:monitor]
107
110
  end
108
111
 
112
+ # @return [ IO ] The file descriptor for the read end of the pipe to
113
+ # listen on during the select system call when reading from the
114
+ # socket.
115
+ def pipe
116
+ options[:pipe]
117
+ end
118
+
109
119
  # @return [ String ] Human-readable summary of the socket for debugging.
110
120
  #
111
121
  # @api private
@@ -161,7 +171,7 @@ module Mongo
161
171
  begin
162
172
  # Sometimes it seems the close call can hang for a long time
163
173
  ::Timeout.timeout(5) do
164
- @socket.close
174
+ @socket&.close
165
175
  end
166
176
  rescue
167
177
  # Silence all errors
@@ -390,7 +400,6 @@ module Mongo
390
400
  raise_timeout_error!("Took more than #{_timeout} seconds to receive data", csot)
391
401
  end
392
402
  end
393
- pipe = options[:pipe]
394
403
  if exc.is_a?(IO::WaitReadable)
395
404
  if pipe
396
405
  select_args = [[@socket, pipe], nil, [@socket, pipe], select_timeout]
data/lib/mongo/version.rb CHANGED
@@ -1,20 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2014-2020 MongoDB Inc.
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
3
  module Mongo
18
4
  # The current version of the driver.
19
- VERSION = '2.21.1'
5
+ #
6
+ # Note that this file is automatically updated via `rake candidate:create`.
7
+ # Manual changes to this file will be overwritten by that rake task.
8
+ VERSION = '2.21.2'
20
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.21.1
4
+ version: 2.21.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - The MongoDB Ruby Team
@@ -553,7 +553,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
553
553
  - !ruby/object:Gem::Version
554
554
  version: '0'
555
555
  requirements: []
556
- rubygems_version: 3.6.8
556
+ rubygems_version: 3.6.9
557
557
  specification_version: 4
558
558
  summary: Ruby driver for MongoDB
559
559
  test_files: []