New Upstream Release - ruby-raindrops

Ready changes

Summary

Merged new upstream version: 0.20.1 (was: 0.20.0).

Diff

diff --git a/.manifest b/.manifest
index d9bf03d..1ae5783 100644
--- a/.manifest
+++ b/.manifest
@@ -49,6 +49,7 @@ test/test_linux_all_tcp_listen_stats.rb
 test/test_linux_all_tcp_listen_stats_leak.rb
 test/test_linux_ipv6.rb
 test/test_linux_middleware.rb
+test/test_linux_reuseport_tcp_listen_stats.rb
 test/test_middleware.rb
 test/test_middleware_unicorn.rb
 test/test_middleware_unicorn_ipv6.rb
diff --git a/GIT-VERSION-FILE b/GIT-VERSION-FILE
index e927a09..9ea27de 100644
--- a/GIT-VERSION-FILE
+++ b/GIT-VERSION-FILE
@@ -1 +1 @@
-GIT_VERSION = 0.20.0
+GIT_VERSION = 0.20.1
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 5d530aa..3ee0b87 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v0.20.0
+DEF_VER=v0.20.1
 
 LF='
 '
diff --git a/LATEST b/LATEST
index 2152506..1232f1b 100644
--- a/LATEST
+++ b/LATEST
@@ -1,10 +1,9 @@
-=== raindrops 0.20.0 / 2021-12-06 23:41 UTC
+=== raindrops 0.20.1 / 2023-02-25 00:19 UTC
 
-  Raindrops may now use file-backed mmap() rather than anonymous
-  memory.  Thanks to KJ Tsanaktsidis for the patch:
+  Stats for SO_REUSEPORT sockets are now handled properly.
+  Thanks to Dale Hamel for the patches.
 
-  https://yhbt.net/raindrops-public/20211125065618.3432-1-ktsanaktsidis@zendesk.com/T/
-
-  The documentation is also updated to note our mail archives are now
-  available via IMAP(S).
+  Dale Hamel (2):
+        Fix queue stats for sockets with SO_REUSEPORT
+        Fix off by one error in test
 
diff --git a/NEWS b/NEWS
index 25654c1..25e3a74 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,12 @@
+=== raindrops 0.20.1 / 2023-02-25 00:19 UTC
+
+  Stats for SO_REUSEPORT sockets are now handled properly.
+  Thanks to Dale Hamel for the patches.
+
+  Dale Hamel (2):
+        Fix queue stats for sockets with SO_REUSEPORT
+        Fix off by one error in test
+
 === raindrops 0.20.0 / 2021-12-06 23:41 UTC
 
   Raindrops may now use file-backed mmap() rather than anonymous
diff --git a/debian/changelog b/debian/changelog
index e8dd702..d0aa136 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+ruby-raindrops (0.20.1-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Thu, 29 Jun 2023 02:13:54 -0000
+
 ruby-raindrops (0.20.0-1) unstable; urgency=medium
 
   * Team upload
diff --git a/debian/patches/0001-Invoke-unix_listener_stats-conditionally.patch b/debian/patches/0001-Invoke-unix_listener_stats-conditionally.patch
index c431515..88b524b 100644
--- a/debian/patches/0001-Invoke-unix_listener_stats-conditionally.patch
+++ b/debian/patches/0001-Invoke-unix_listener_stats-conditionally.patch
@@ -9,11 +9,11 @@ isn't allowed to access /proc.
  lib/raindrops/watcher.rb | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/lib/raindrops/watcher.rb b/lib/raindrops/watcher.rb
-index ac5b895..a24ea69 100644
---- a/lib/raindrops/watcher.rb
-+++ b/lib/raindrops/watcher.rb
-@@ -171,7 +171,7 @@ def aggregator_thread(logger) # :nodoc:
+Index: ruby-raindrops.git/lib/raindrops/watcher.rb
+===================================================================
+--- ruby-raindrops.git.orig/lib/raindrops/watcher.rb
++++ ruby-raindrops.git/lib/raindrops/watcher.rb
+@@ -171,7 +171,7 @@ class Raindrops::Watcher
      thr = Thread.new do
        begin
          combined = tcp_listener_stats(@tcp_listeners, sock)
diff --git a/debian/patches/0002-Disable-tests-which-require-inet_diag-or-tcp_diag-ke.patch b/debian/patches/0002-Disable-tests-which-require-inet_diag-or-tcp_diag-ke.patch
index 4d85663..c6b4adc 100644
--- a/debian/patches/0002-Disable-tests-which-require-inet_diag-or-tcp_diag-ke.patch
+++ b/debian/patches/0002-Disable-tests-which-require-inet_diag-or-tcp_diag-ke.patch
@@ -8,11 +8,11 @@ Subject: Disable tests which require inet_diag or tcp_diag kernel modules
  test/test_linux.rb | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
 
-diff --git a/test/test_linux.rb b/test/test_linux.rb
-index 7808469..749ac55 100644
---- a/test/test_linux.rb
-+++ b/test/test_linux.rb
-@@ -107,7 +107,7 @@ def test_unix_resolves_symlinks
+Index: ruby-raindrops.git/test/test_linux.rb
+===================================================================
+--- ruby-raindrops.git.orig/test/test_linux.rb
++++ ruby-raindrops.git/test/test_linux.rb
+@@ -107,7 +107,7 @@ class TestLinux < Test::Unit::TestCase
      assert_equal 1, stats[tmp.path].queued
    end
  
@@ -21,7 +21,7 @@ index 7808469..749ac55 100644
      s = TCPServer.new(TEST_ADDR, 0)
      port = s.addr[1]
      addr = "#{TEST_ADDR}:#{port}"
-@@ -130,7 +130,7 @@ def test_tcp
+@@ -130,7 +130,7 @@ class TestLinux < Test::Unit::TestCase
      assert_equal 1, stats[addr].active
    end
  
@@ -30,7 +30,7 @@ index 7808469..749ac55 100644
      nlsock = Raindrops::InetDiagSocket.new
      s = TCPServer.new(TEST_ADDR, 0)
      port = s.addr[1]
-@@ -156,7 +156,7 @@ def test_tcp_reuse_sock
+@@ -156,7 +156,7 @@ class TestLinux < Test::Unit::TestCase
      nlsock.close
    end
  
diff --git a/ext/raindrops/linux_inet_diag.c b/ext/raindrops/linux_inet_diag.c
index cabd427..2a2360c 100644
--- a/ext/raindrops/linux_inet_diag.c
+++ b/ext/raindrops/linux_inet_diag.c
@@ -306,7 +306,7 @@ static void table_set_queued(st_table *table, struct inet_diag_msg *r)
 {
 	struct listen_stats *stats = stats_for(table, r);
 	stats->listener_p = 1;
-	stats->queued = r->idiag_rqueue;
+	stats->queued += r->idiag_rqueue;
 }
 
 /* inner loop of inet_diag, called for every socket returned by netlink */
@@ -328,7 +328,7 @@ static inline void r_acc(struct nogvl_args *args, struct inet_diag_msg *r)
 		if (args->table)
 			table_set_queued(args->table, r);
 		else
-			args->stats.queued = r->idiag_rqueue;
+			args->stats.queued += r->idiag_rqueue;
 	}
 	/*
 	 * we wont get anything else because of the idiag_states filter
diff --git a/test/test_linux_reuseport_tcp_listen_stats.rb b/test/test_linux_reuseport_tcp_listen_stats.rb
new file mode 100644
index 0000000..73995ea
--- /dev/null
+++ b/test/test_linux_reuseport_tcp_listen_stats.rb
@@ -0,0 +1,51 @@
+# -*- encoding: binary -*-
+require "./test/rack_unicorn"
+require 'test/unit'
+require 'socket'
+require 'raindrops'
+$stderr.sync = $stdout.sync = true
+
+class TestLinuxReuseportTcpListenStats < Test::Unit::TestCase
+  include Raindrops::Linux
+  include Unicorn::SocketHelper
+  TEST_ADDR = ENV['UNICORN_TEST_ADDR'] || '127.0.0.1'
+  DEFAULT_BACKLOG = 10
+
+  def setup
+    @socks = []
+  end
+
+  def teardown
+    @socks.each { |io| io.closed? or io.close }
+  end
+
+  def new_socket_server(**kwargs)
+    s = new_tcp_server TEST_ADDR, kwargs[:port] || 0, kwargs
+    s.listen(kwargs[:backlog] || DEFAULT_BACKLOG)
+    @socks << s
+    [ s, s.addr[1] ]
+  end
+
+  def new_client(port)
+    s = TCPSocket.new("127.0.0.1", port)
+    @socks << s
+    s
+  end
+
+  def test_reuseport_queue_stats
+    listeners = 10
+    _, port = new_socket_server(reuseport: true)
+    addr = "#{TEST_ADDR}:#{port}"
+    (listeners - 1).times do
+      new_socket_server(reuseport: true, port: port)
+    end
+
+    listeners.times do |i|
+      all = Raindrops::Linux.tcp_listener_stats
+      assert_equal [0, i], all[addr].to_a
+      new_client(port)
+      all = Raindrops::Linux.tcp_listener_stats
+      assert_equal [0, i+1], all[addr].to_a
+    end
+  end
+end if RUBY_PLATFORM =~ /linux/

More details

Full run details

Historical runs