commit rubygem-bunny for openSUSE:Factory
Hello community, here is the log from the commit of package rubygem-bunny for openSUSE:Factory checked in at 2017-10-01 17:01:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-bunny (Old) and /work/SRC/openSUSE:Factory/.rubygem-bunny.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "rubygem-bunny" Sun Oct 1 17:01:46 2017 rev:37 rq:529899 version:2.7.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-bunny/rubygem-bunny.changes 2017-06-08 14:59:39.755310452 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-bunny.new/rubygem-bunny.changes 2017-10-01 17:01:47.466907301 +0200 @@ -1,0 +2,6 @@ +Fri Sep 29 11:02:55 UTC 2017 - mdeniz@suse.com + +- updated to version 2.7.1 + see installed ChangeLog.md + +------------------------------------------------------------------- Old: ---- bunny-2.7.0.gem New: ---- bunny-2.7.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-bunny.spec ++++++ --- /var/tmp/diff_new_pack.QO8v3s/_old 2017-10-01 17:01:49.774582660 +0200 +++ /var/tmp/diff_new_pack.QO8v3s/_new 2017-10-01 17:01:49.782581535 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-bunny -Version: 2.7.0 +Version: 2.7.1 Release: 0 %define mod_name bunny %define mod_full_name %{mod_name}-%{version} @@ -33,7 +33,7 @@ BuildRequires: %{rubygem gem2rpm} BuildRequires: ruby-macros >= 5 Url: http://rubybunny.info -Source: http://rubygems.org/gems/%{mod_full_name}.gem +Source: https://rubygems.org/gems/%{mod_full_name}.gem Source1: gem2rpm.yml # MANUAL Patch0: bunny-2.6.2-set-default-paths.diff ++++++ bunny-2.7.0.gem -> bunny-2.7.1.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CONTRIBUTING.md new/CONTRIBUTING.md --- old/CONTRIBUTING.md 2017-05-11 01:14:09.000000000 +0200 +++ new/CONTRIBUTING.md 2017-09-25 00:17:26.000000000 +0200 @@ -30,8 +30,10 @@ the tests allow for expecting hostname overriding using the `BUNNY_RABBITMQ_HOSTNAME` environment variables (default value is `127.0.0.1`). -Server, CA and client certificates can be found under `spec/tls`. They are supposed to be -generated with [tls-gen](github.com/michaelklishin/tls-gen) or similar in the target environment. +Server, CA and client certificates can be found under `spec/tls`. +The location can be overridden via the `BUNNY_CERTIFICATE_DIR` environment variable. +It is supposed to target [tls-gen](https://github.com/michaelklishin/tls-gen)'s basic profile +output (result) directory on the host where specs are to be executed. Next up you'll need to prepare your node for the specs (just once): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ChangeLog.md new/ChangeLog.md --- old/ChangeLog.md 2017-05-11 01:14:09.000000000 +0200 +++ new/ChangeLog.md 2017-09-25 00:17:26.000000000 +0200 @@ -1,8 +1,52 @@ -## Changes between Bunny 2.7.0 and 2.8.0 (unreleased) +## Changes between Bunny 2.7.1 and 2.7.2 (unreleased) No changes yet. +## Changes between Bunny 2.7.0 and 2.7.1 (Sep 25th, 2017) + +### Sensible Socket Read Timeouts When RabbitMQ is Configured to Disabled Heartbeats + +Bunny now correctly handles scenarios where server is configured +to disable heartbeats (which is a terrible idea, don't do it!) + +GitHub issue: [#519](https://github.com/ruby-amqp/bunny/issues/519). + +### Bunny::Channel#basic_get Usability + +`Bunny::Channel#basic_get` invoked with a non-existent queue now +throws a channel exception instead of a generic operation timeout. + +GitHub issue: [#518](https://github.com/ruby-amqp/bunny/issues/518). + +### Spec Suite Improvements + +`BUNNY_CERTIFICATE_DIR` environment variable now can be used +to override local CA and client certificate/key pair directory. +The directory is expected to be the result directory generated +by the basic [tls-gen](http://github.com/michaelklishin/tls-gen) profile. + +TLSv1.0 is no longer used in tests because it's being disabled by default +by more and more installations as it has known vulnerabilities +and is no longer considered to be acceptable by several compliance +standards (e.g. PCI DSS). + +### Improved Synchronisation for channel.close Handlers + +`channel.close` handler will now acquire a lock . This avoids concurrency +hazards in some rare scenarios when a channel is closed due a protocol +exception by the server and concurrently opened by user code +at the same time. + +### More Meaningful Error Messages in Bunny::Session#create_channel + +Sometimes users attempt to open a channel on a connection that +isn't connected yet because `Bunny::Session#start` was never invoked. + +`Bunny::Session#create_channel` will now provide a more sensible exception message +in those cases. + + ## Changes between Bunny 2.6.0 and 2.7.0 (May 11th, 2017) ### amq-protocol Update diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2017-05-11 01:14:09.000000000 +0200 +++ new/README.md 2017-09-25 00:17:26.000000000 +0200 @@ -88,7 +88,7 @@ To use Bunny in a project managed with Bundler: ``` ruby -gem "bunny", ">= 2.6.5" +gem "bunny", ">= 2.7.0" ``` Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/channel.rb new/lib/bunny/channel.rb --- old/lib/bunny/channel.rb 2017-05-11 01:14:09.000000000 +0200 +++ new/lib/bunny/channel.rb 2017-09-25 00:17:26.000000000 +0200 @@ -602,7 +602,12 @@ # we implement them). So we return a triple of nils immediately which apps should be # able to handle anyway as "got no message, no need to act". MK. last_basic_get_response = if @connection.open? - wait_on_basic_get_continuations + begin + wait_on_basic_get_continuations + rescue Timeout::Error => e + raise_if_continuation_resulted_in_a_channel_error! + raise e + end else [nil, nil, nil] end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/session.rb new/lib/bunny/session.rb --- old/lib/bunny/session.rb 2017-05-11 01:14:09.000000000 +0200 +++ new/lib/bunny/session.rb 2017-09-25 00:17:26.000000000 +0200 @@ -101,16 +101,18 @@ # @option connection_string_or_opts [String] :username ("guest") Username # @option connection_string_or_opts [String] :password ("guest") Password # @option connection_string_or_opts [String] :vhost ("/") Virtual host to use - # @option connection_string_or_opts [Integer] :heartbeat (600) Heartbeat interval. 0 means no heartbeat. + # @option connection_string_or_opts [Integer, Symbol] :heartbeat (:server) Heartbeat interval. :server means use the default suggested by RabbitMQ. 0 means no heartbeat (not recommended). # @option connection_string_or_opts [Integer] :network_recovery_interval (4) Recovery interval periodic network recovery will use. This includes initial pause after network failure. # @option connection_string_or_opts [Boolean] :tls (false) Should TLS/SSL be used? # @option connection_string_or_opts [String] :tls_cert (nil) Path to client TLS/SSL certificate file (.pem) # @option connection_string_or_opts [String] :tls_key (nil) Path to client TLS/SSL private key file (.pem) # @option connection_string_or_opts [Array<String>] :tls_ca_certificates Array of paths to TLS/SSL CA files (.pem), by default detected from OpenSSL configuration # @option connection_string_or_opts [String] :verify_peer (true) Whether TLS peer verification should be performed - # @option connection_string_or_opts [Keyword] :tls_version (negotiated) What TLS version should be used (:TLSv1, :TLSv1_1, or :TLSv1_2) + # @option connection_string_or_opts [Symbol] :tls_version (negotiated) What TLS version should be used (:TLSv1, :TLSv1_1, or :TLSv1_2) # @option connection_string_or_opts [Integer] :continuation_timeout (15000) Timeout for client operations that expect a response (e.g. {Bunny::Queue#get}), in milliseconds. - # @option connection_string_or_opts [Integer] :connection_timeout (5) Timeout in seconds for connecting to the server. + # @option connection_string_or_opts [Integer] :connection_timeout (30) Timeout in seconds for connecting to the server. + # @option connection_string_or_opts [Integer] :read_timeout (30) TCP socket read timeout in seconds. + # @option connection_string_or_opts [Integer] :write_timeout (30) TCP socket write timeout in seconds. # @option connection_string_or_opts [Proc] :hosts_shuffle_strategy A Proc that reorders a list of host strings, defaults to Array#shuffle # @option connection_string_or_opts [Logger] :logger The logger. If missing, one is created using :log_file and :log_level. # @option connection_string_or_opts [IO, String] :log_file The file or path to use when creating a logger. Defaults to STDOUT. @@ -346,6 +348,7 @@ def create_channel(n = nil, consumer_pool_size = 1, consumer_pool_abort_on_exception = false, consumer_pool_shutdown_timeout = 60) raise ArgumentError, "channel number 0 is reserved in the protocol and cannot be used" if 0 == n raise ConnectionAlreadyClosed if manually_closed? + raise RuntimeError, "this connection is not open. Was Bunny::Session#start invoked? Is automatic recovery enabled?" if !connected? @channel_mutex.synchronize do if n && (ch = @channels[n]) @@ -541,6 +544,16 @@ end # @private + def find_channel(number) + @channels[number] + end + + # @private + def synchronised_find_channel(number) + @channel_mutex.synchronize { @channels[number] } + end + + # @private def close_all_channels @channel_mutex.synchronize do @channels.reject {|n, ch| n == 0 || !ch.open? }.each do |_, ch| @@ -606,15 +619,20 @@ @unblock_callback.call(method) if @unblock_callback when AMQ::Protocol::Channel::Close then begin - ch = @channels[ch_number] + ch = synchronised_find_channel(ch_number) + # this includes sending a channel.close-ok and + # potentially invoking a user-provided callback, + # avoid doing that while holding a mutex lock. MK. ch.handle_method(method) ensure + # synchronises on @channel_mutex under the hood self.unregister_channel(ch) end when AMQ::Protocol::Basic::GetEmpty then - @channels[ch_number].handle_basic_get_empty(method) + ch = find_channel(ch_number) + ch.handle_basic_get_empty(method) else - if ch = @channels[ch_number] + if ch = find_channel(ch_number) ch.handle_method(method) else @logger.warn "Channel #{ch_number} is not open on this connection!" @@ -1161,11 +1179,18 @@ # We set the read_write_timeout to twice the heartbeat value # This allows us to miss a single heartbeat before we time out the socket. - @transport.read_timeout = if heartbeat_disabled?(@client_heartbeat) + # + # Since RabbitMQ can be configured to disable heartbeats (bad idea but technically + # possible nonetheless), we need to take both client and server values into + # consideration when deciding about using the heartbeat value for read timeouts. + @transport.read_timeout = if heartbeat_disabled?(@client_heartbeat) || heartbeat_disabled?(@heartbeat) + @logger.debug { "Will use default socket read timeout of #{Transport::DEFAULT_READ_TIMEOUT}" } Transport::DEFAULT_READ_TIMEOUT else # pad to account for edge cases. MK. - @heartbeat * 2.2 + n = @heartbeat * 2.2 + @logger.debug { "Will use socket read timeout of #{n}" } + n end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/version.rb new/lib/bunny/version.rb --- old/lib/bunny/version.rb 2017-05-11 01:14:09.000000000 +0200 +++ new/lib/bunny/version.rb 2017-09-25 00:17:26.000000000 +0200 @@ -2,5 +2,5 @@ module Bunny # @return [String] Version of the library - VERSION = "2.7.0" + VERSION = "2.7.1" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2017-05-11 01:14:09.000000000 +0200 +++ new/metadata 2017-09-25 00:17:26.000000000 +0200 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: bunny version: !ruby/object:Gem::Version - version: 2.7.0 + version: 2.7.1 platform: ruby authors: - Chris Duncan @@ -12,7 +12,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2017-05-10 00:00:00.000000000 Z +date: 2017-09-24 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: amq-protocol @@ -231,7 +231,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.6.11 +rubygems_version: 2.6.13 signing_key: specification_version: 4 summary: Popular easy to use Ruby client for RabbitMQ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/higher_level_api/integration/basic_get_spec.rb new/spec/higher_level_api/integration/basic_get_spec.rb --- old/spec/higher_level_api/integration/basic_get_spec.rb 2017-05-11 01:14:09.000000000 +0200 +++ new/spec/higher_level_api/integration/basic_get_spec.rb 2017-09-25 00:17:26.000000000 +0200 @@ -54,3 +54,27 @@ end end end + + +describe Bunny::Channel, "#basic_get" do + let(:connection) do + c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed", + automatically_recover: false, continuation_timeout: 3000) + c.start + c + end + + after :each do + connection.close if connection.open? + end + + context "with a non-existent queue" do + it "throws a NOT_FOUND" do + ch = connection.create_channel + + expect do + ch.basic_get "non_existent_#{rand.to_s}" + end.to raise_error(Bunny::NotFound) + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/higher_level_api/integration/tls_connection_spec.rb new/spec/higher_level_api/integration/tls_connection_spec.rb --- old/spec/higher_level_api/integration/tls_connection_spec.rb 2017-05-11 01:14:09.000000000 +0200 +++ new/spec/higher_level_api/integration/tls_connection_spec.rb 2017-09-25 00:17:26.000000000 +0200 @@ -2,10 +2,14 @@ require "spec_helper" unless ENV["CI"] + CERTIFICATE_DIR=ENV.fetch("BUNNY_CERTIFICATE_DIR", "./spec/tls") + puts "Will use certificates from #{CERTIFICATE_DIR}" + shared_examples_for "successful TLS connection" do it "succeeds" do - expect(connection).to be_tls - ch = connection.create_channel + expect(subject).to be_tls + ch = subject.create_channel + ch.confirm_select q = ch.queue("", exclusive: true) x = ch.default_exchange @@ -15,7 +19,7 @@ publish("xyzzy", routing_key: q.name). publish("xyzzy", routing_key: q.name) - sleep 0.5 + x.wait_for_confirms expect(q.message_count).to eq 4 i = 0 @@ -41,9 +45,9 @@ :vhost => "bunny_testbed", :tls => true, :verify_peer => verify_peer, - :tls_cert => "spec/tls/client_certificate.pem", - :tls_key => "spec/tls/client_key.pem", - :tls_ca_certificates => ["./spec/tls/ca_certificate.pem"]) + :tls_cert => "#{CERTIFICATE_DIR}/client_certificate.pem", + :tls_key => "#{CERTIFICATE_DIR}/client_key.pem", + :tls_ca_certificates => ["#{CERTIFICATE_DIR}/ca_certificate.pem"]) end context "peer verification is off" do @@ -58,6 +62,10 @@ subject.start expect(subject.transport.socket.hostname).to_not be_empty end + + after :each do + subject.close + end end context "peer verification is on" do @@ -70,21 +78,21 @@ end describe "TLS connection to RabbitMQ with client certificates" do - let(:connection) do + let(:subject) do c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed", tls: true, - tls_cert: "spec/tls/client_certificate.pem", - tls_key: "spec/tls/client_key.pem", - tls_ca_certificates: ["./spec/tls/ca_certificate.pem"], + tls_cert: "#{CERTIFICATE_DIR}/client_certificate.pem", + tls_key: "#{CERTIFICATE_DIR}/client_key.pem", + tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"], verify_peer: false) c.start c end after :each do - connection.close + subject.close end include_examples "successful TLS connection" @@ -92,19 +100,19 @@ describe "TLS connection to RabbitMQ without client certificates" do - let(:connection) do + let(:subject) do c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed", tls: true, - tls_ca_certificates: ["./spec/tls/ca_certificate.pem"], + tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"], verify_peer: false) c.start c end after :each do - connection.close + subject.close end include_examples "successful TLS connection" @@ -112,18 +120,18 @@ describe "TLS connection to RabbitMQ with a connection string" do - let(:connection) do + let(:subject) do c = Bunny.new("amqps://bunny_gem:bunny_password@#{local_hostname}/bunny_testbed", - tls_cert: "spec/tls/client_certificate.pem", - tls_key: "spec/tls/client_key.pem", - tls_ca_certificates: ["./spec/tls/ca_certificate.pem"], + tls_cert: "#{CERTIFICATE_DIR}/client_certificate.pem", + tls_key: "#{CERTIFICATE_DIR}/client_key.pem", + tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"], verify_peer: false) c.start c end after :each do - connection.close + subject.close end include_examples "successful TLS connection" @@ -131,16 +139,16 @@ describe "TLS connection to RabbitMQ with a connection string and w/o client certificate and key" do - let(:connection) do + let(:subject) do c = Bunny.new("amqps://bunny_gem:bunny_password@#{local_hostname}/bunny_testbed", - tls_ca_certificates: ["./spec/tls/ca_certificate.pem"], + tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"], verify_peer: verify_peer) c.start c end after :each do - connection.close + subject.close end context "peer verification is off" do @@ -150,7 +158,7 @@ it "sends the SNI details" do # https://github.com/ruby-amqp/bunny/issues/440 - expect(connection.transport.socket.hostname).to_not be_empty + expect(subject.transport.socket.hostname).to_not be_empty end end @@ -161,54 +169,54 @@ it "sends the SNI details" do # https://github.com/ruby-amqp/bunny/issues/440 - expect(connection.transport.socket.hostname).to_not be_empty + expect(subject.transport.socket.hostname).to_not be_empty end end end describe "TLS connection to RabbitMQ with client certificates provided inline" do - let(:connection) do + let(:subject) do c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed", tls: true, - tls_cert: File.read("./spec/tls/client_certificate.pem"), - tls_key: File.read("./spec/tls/client_key.pem"), - tls_ca_certificates: ["./spec/tls/ca_certificate.pem"], + tls_cert: File.read("#{CERTIFICATE_DIR}/client_certificate.pem"), + tls_key: File.read("#{CERTIFICATE_DIR}/client_key.pem"), + tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"], verify_peer: false) c.start c end after :each do - connection.close + subject.close end include_examples "successful TLS connection" end - describe "TLS connection to RabbitMQ with tls_version TLSv1 specified" do - let(:connection) do + describe "TLS connection to RabbitMQ with tls_version TLSv1.1 specified" do + let(:subject) do c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed", tls: true, - tls_protocol: :TLSv1, - tls_ca_certificates: ["./spec/tls/ca_certificate.pem"], + tls_protocol: :TLSv1_1, + tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"], verify_peer: false) c.start c end after :each do - connection.close + subject.close end include_examples "successful TLS connection" - it "connects using TLSv1" do - expect(connection.transport.socket.ssl_version).to eq "TLSv1" + it "connects using TLSv1.1" do + expect(subject.transport.socket.ssl_version).to eq "TLSv1.1" end end end
participants (1)
-
root@hilbert.suse.de