raindrops 0.19.0 → 0.19.1
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 +5 -5
- data/.olddoc.yml +6 -7
- data/GIT-VERSION-GEN +1 -1
- data/GNUmakefile +1 -1
- data/README +6 -5
- data/examples/linux-listener-stats.rb +1 -2
- data/examples/watcher_demo.ru +1 -1
- data/ext/raindrops/extconf.rb +1 -1
- data/ext/raindrops/linux_inet_diag.c +1 -1
- data/lib/raindrops.rb +1 -1
- data/lib/raindrops/aggregate/pmq.rb +6 -6
- data/lib/raindrops/linux.rb +4 -5
- data/lib/raindrops/middleware.rb +2 -2
- data/lib/raindrops/watcher.rb +7 -7
- data/pkg.mk +1 -1
- data/raindrops.gemspec +2 -2
- data/test/ipv6_enabled.rb +4 -4
- data/test/test_linux.rb +3 -2
- data/test/test_linux_all_tcp_listen_stats_leak.rb +2 -2
- data/test/test_raindrops.rb +1 -1
- data/test/test_tcp_info.rb +4 -4
- data/test/test_watcher.rb +9 -9
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0c5318918bfd5808ecc840404c67ed59f80019c6a705ef434b10ae92da78ba06
|
4
|
+
data.tar.gz: 1f25061c601aab07e3eb041cc9c2fd005438a1527994e0696b5eafc8dc148650
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df8be08761d8444a8599da3a5885efc806df935820753f5b000f27ab408171438b0f6ff4650810b5096e648904f5993bbc2a1303b9571df213201919b4b7f565
|
7
|
+
data.tar.gz: 250b7236881f06fdd684b22f4844cacb7a0d2ca43703220fe3f0f4ebc49e51faf2015864ef6776edc0d66c7dfd2762e08145548a5dd06b55c2193e989f21a3fd
|
data/.olddoc.yml
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
---
|
2
|
-
cgit_url: https://
|
3
|
-
|
4
|
-
|
5
|
-
public_email: raindrops-public@bogomips.org
|
2
|
+
cgit_url: https://yhbt.net/raindrops.git/
|
3
|
+
rdoc_url: https://yhbt.net/raindrops/
|
4
|
+
public_email: raindrops-public@yhbt.net
|
6
5
|
ml_url:
|
7
|
-
- https://
|
6
|
+
- https://yhbt.net/raindrops-public/
|
8
7
|
- http://ou63pmih66umazou.onion/raindrops-public
|
9
8
|
nntp_url:
|
10
9
|
- nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
|
11
10
|
- nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.raindrops
|
12
11
|
source_code:
|
13
|
-
- git clone
|
14
|
-
- git clone
|
12
|
+
- git clone https://yhbt.net/raindrops.git
|
13
|
+
- torsocks git clone http://ou63pmih66umazou.onion/raindrops.git
|
data/GIT-VERSION-GEN
CHANGED
data/GNUmakefile
CHANGED
data/README
CHANGED
@@ -59,20 +59,20 @@ If you use RubyGems:
|
|
59
59
|
See Raindrops::Middleware and Raindrops::LastDataRecv documentation for
|
60
60
|
use Rack servers. The entire library is fully-documented and we are
|
61
61
|
responsive on the publically archived mailing list
|
62
|
-
(mailto:raindrops-public@
|
62
|
+
(mailto:raindrops-public@yhbt.net) if
|
63
63
|
you have any questions or comments.
|
64
64
|
|
65
65
|
== Development
|
66
66
|
|
67
67
|
You can get the latest source via git from the following locations:
|
68
68
|
|
69
|
-
git://
|
69
|
+
git://yhbt.net/raindrops.git
|
70
70
|
git://repo.or.cz/raindrops.git (mirror)
|
71
71
|
|
72
72
|
You may browse the code from the web and download the latest snapshot
|
73
73
|
tarballs here:
|
74
74
|
|
75
|
-
* https://
|
75
|
+
* https://yhbt.net/raindrops.git
|
76
76
|
* http://repo.or.cz/w/raindrops.git (gitweb)
|
77
77
|
|
78
78
|
Inline patches (from "git format-patch") to the mailing list are
|
@@ -90,11 +90,12 @@ raindrops is licensed under the LGPL-2.1+
|
|
90
90
|
|
91
91
|
All feedback (bug reports, user/development discussion, patches, pull
|
92
92
|
requests) go to the publically archived mailing list:
|
93
|
-
mailto:raindrops-public@
|
93
|
+
mailto:raindrops-public@yhbt.net
|
94
94
|
|
95
95
|
Mailing list archives are available over HTTPS and NNTP:
|
96
96
|
|
97
|
-
* https://
|
97
|
+
* https://yhbt.net/raindrops-public/
|
98
|
+
* http://ou63pmih66umazou.onion/raindrops-public/
|
98
99
|
* nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
|
99
100
|
|
100
101
|
Since archives are public, scrub sensitive information and
|
@@ -15,7 +15,6 @@
|
|
15
15
|
usage = "Usage: #$0 [-d DELAY] [-t QUEUED_THRESHOLD] ADDR..."
|
16
16
|
ARGV.size > 0 or abort usage
|
17
17
|
delay = false
|
18
|
-
all = false
|
19
18
|
queued_thresh = -1
|
20
19
|
# "normal" exits when driven on the command-line
|
21
20
|
trap(:INT) { exit 130 }
|
@@ -25,7 +24,7 @@
|
|
25
24
|
opts.banner = usage
|
26
25
|
opts.on('-d', '--delay=DELAY', Float) { |n| delay = n }
|
27
26
|
opts.on('-t', '--queued-threshold=INT', Integer) { |n| queued_thresh = n }
|
28
|
-
opts.on('-a', '--all') {
|
27
|
+
opts.on('-a', '--all') { } # noop
|
29
28
|
opts.parse! ARGV
|
30
29
|
end
|
31
30
|
|
data/examples/watcher_demo.ru
CHANGED
data/ext/raindrops/extconf.rb
CHANGED
data/lib/raindrops.rb
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
# Unlike many classes in this package, the core Raindrops class is
|
13
13
|
# intended to be portable to all reasonably modern *nix systems
|
14
14
|
# supporting mmap(). Please let us know if you have portability
|
15
|
-
# issues, patches or pull requests at mailto:raindrops-public@
|
15
|
+
# issues, patches or pull requests at mailto:raindrops-public@yhbt.net
|
16
16
|
class Raindrops
|
17
17
|
|
18
18
|
# Used to represent the number of +active+ and +queued+ sockets for
|
@@ -142,8 +142,8 @@ def master_loop
|
|
142
142
|
warn "Unhandled exception in #{__FILE__}:#{__LINE__}: #{e}"
|
143
143
|
break
|
144
144
|
end while true
|
145
|
-
|
146
|
-
|
145
|
+
ensure
|
146
|
+
flush_master
|
147
147
|
end
|
148
148
|
|
149
149
|
# Loads the last shared \Aggregate from the master thread/process
|
@@ -175,14 +175,14 @@ def flush_master
|
|
175
175
|
# worker thread or process
|
176
176
|
def stop_master_loop
|
177
177
|
sleep 0.1 until mq_send(false)
|
178
|
-
|
179
|
-
|
178
|
+
rescue Errno::EINTR
|
179
|
+
retry
|
180
180
|
end
|
181
181
|
|
182
182
|
def lock! io, type # :nodoc:
|
183
183
|
io.fcntl Fcntl::F_SETLKW, type
|
184
|
-
|
185
|
-
|
184
|
+
rescue Errno::EINTR
|
185
|
+
retry
|
186
186
|
end
|
187
187
|
|
188
188
|
# we use both a mutex for thread-safety and fcntl lock for process-safety
|
data/lib/raindrops/linux.rb
CHANGED
@@ -14,8 +14,7 @@ module Raindrops::Linux
|
|
14
14
|
# The standard proc path for active UNIX domain sockets, feel free to call
|
15
15
|
# String#replace on this if your /proc is mounted in a non-standard location
|
16
16
|
# for whatever reason
|
17
|
-
PROC_NET_UNIX_ARGS =
|
18
|
-
defined?(::Encoding) and PROC_NET_UNIX_ARGS.push({ :encoding => "binary" })
|
17
|
+
PROC_NET_UNIX_ARGS = [ '/proc/net/unix', { encoding: "binary" }]
|
19
18
|
|
20
19
|
# Get ListenStats from an array of +paths+
|
21
20
|
#
|
@@ -42,11 +41,11 @@ def unix_listener_stats(paths = nil)
|
|
42
41
|
else
|
43
42
|
paths = paths.map do |path|
|
44
43
|
path = path.dup
|
45
|
-
path.force_encoding(Encoding::BINARY)
|
44
|
+
path.force_encoding(Encoding::BINARY)
|
46
45
|
if File.symlink?(path)
|
47
46
|
link = path
|
48
47
|
path = File.readlink(link)
|
49
|
-
path.force_encoding(Encoding::BINARY)
|
48
|
+
path.force_encoding(Encoding::BINARY)
|
50
49
|
rv[link] = rv[path] # vivify ListenerStats
|
51
50
|
else
|
52
51
|
rv[path] # vivify ListenerStats
|
@@ -57,7 +56,7 @@ def unix_listener_stats(paths = nil)
|
|
57
56
|
paths = /^\w+: \d+ \d+ (\d+) \d+ (\d+)\s+\d+ (#{paths.join('|')})$/n
|
58
57
|
|
59
58
|
# no point in pread since we can't stat for size on this file
|
60
|
-
File.read(
|
59
|
+
File.read(PROC_NET_UNIX_ARGS[0], encoding: 'binary').scan(paths) do |s|
|
61
60
|
path = s[-1]
|
62
61
|
case s[0]
|
63
62
|
when "00000000" # client sockets
|
data/lib/raindrops/middleware.rb
CHANGED
@@ -62,9 +62,9 @@
|
|
62
62
|
# = Demo Server
|
63
63
|
#
|
64
64
|
# There is a server running this middleware (and Watcher) at
|
65
|
-
# https://raindrops-demo
|
65
|
+
# https://yhbt.net/raindrops-demo/_raindrops
|
66
66
|
#
|
67
|
-
# Also check out the Watcher demo at https://raindrops-demo
|
67
|
+
# Also check out the Watcher demo at https://yhbt.net/raindrops-demo/
|
68
68
|
#
|
69
69
|
# The demo server is only limited to 30 users, so be sure not to abuse it
|
70
70
|
# by using the /tail/ endpoint too much.
|
data/lib/raindrops/watcher.rb
CHANGED
@@ -35,28 +35,28 @@
|
|
35
35
|
# Returns a plain text summary + histogram with X-* HTTP headers for
|
36
36
|
# active connections.
|
37
37
|
#
|
38
|
-
# e.g.: curl https://raindrops-demo
|
38
|
+
# e.g.: curl https://yhbt.net/raindrops-demo/active/0.0.0.0%3A80.txt
|
39
39
|
#
|
40
40
|
# === GET /active/$LISTENER.html
|
41
41
|
#
|
42
42
|
# Returns an HTML summary + histogram with X-* HTTP headers for
|
43
43
|
# active connections.
|
44
44
|
#
|
45
|
-
# e.g.: curl https://raindrops-demo
|
45
|
+
# e.g.: curl https://yhbt.net/raindrops-demo/active/0.0.0.0%3A80.html
|
46
46
|
#
|
47
47
|
# === GET /queued/$LISTENER.txt
|
48
48
|
#
|
49
49
|
# Returns a plain text summary + histogram with X-* HTTP headers for
|
50
50
|
# queued connections.
|
51
51
|
#
|
52
|
-
# e.g.: curl https://raindrops-demo
|
52
|
+
# e.g.: curl https://yhbt.net/raindrops-demo/queued/0.0.0.0%3A80.txt
|
53
53
|
#
|
54
54
|
# === GET /queued/$LISTENER.html
|
55
55
|
#
|
56
56
|
# Returns an HTML summary + histogram with X-* HTTP headers for
|
57
57
|
# queued connections.
|
58
58
|
#
|
59
|
-
# e.g.: curl https://raindrops-demo
|
59
|
+
# e.g.: curl https://yhbt.net/raindrops-demo/queued/0.0.0.0%3A80.html
|
60
60
|
#
|
61
61
|
# === POST /reset/$LISTENER
|
62
62
|
#
|
@@ -95,9 +95,9 @@
|
|
95
95
|
#
|
96
96
|
# = Demo Server
|
97
97
|
#
|
98
|
-
# There is a server running this app at https://raindrops-demo
|
98
|
+
# There is a server running this app at https://yhbt.net/raindrops-demo/
|
99
99
|
# The Raindrops::Middleware demo is also accessible at
|
100
|
-
# https://raindrops-demo
|
100
|
+
# https://yhbt.net/raindrops-demo/_raindrops
|
101
101
|
#
|
102
102
|
# The demo server is only limited to 30 users, so be sure not to abuse it
|
103
103
|
# by using the /tail/ endpoint too much.
|
@@ -106,7 +106,7 @@ class Raindrops::Watcher
|
|
106
106
|
attr_reader :snapshot
|
107
107
|
include Rack::Utils
|
108
108
|
include Raindrops::Linux
|
109
|
-
DOC_URL = "https://
|
109
|
+
DOC_URL = "https://yhbt.net/raindrops/Raindrops/Watcher.html"
|
110
110
|
Peak = Struct.new(:first, :last)
|
111
111
|
|
112
112
|
def initialize(opts = {})
|
data/pkg.mk
CHANGED
@@ -60,7 +60,7 @@ doc:: .document .olddoc.yml $(pkg_extra) $(PLACEHOLDERS)
|
|
60
60
|
-find lib -type f -name '*.rbc' -exec rm -f '{}' ';'
|
61
61
|
-find ext -type f -name '*.rbc' -exec rm -f '{}' ';'
|
62
62
|
$(RM) -r doc
|
63
|
-
$(RDOC) -f
|
63
|
+
$(RDOC) -f dark216
|
64
64
|
$(OLDDOC) merge
|
65
65
|
install -m644 COPYING doc/COPYING
|
66
66
|
install -m644 NEWS doc/NEWS
|
data/raindrops.gemspec
CHANGED
@@ -8,13 +8,13 @@
|
|
8
8
|
s.version = (ENV["VERSION"] ||= '0.18.0').dup
|
9
9
|
s.authors = ["raindrops hackers"]
|
10
10
|
s.description = File.read('README').split("\n\n")[1]
|
11
|
-
s.email = %q{raindrops-public@
|
11
|
+
s.email = %q{raindrops-public@yhbt.net}
|
12
12
|
s.extensions = %w(ext/raindrops/extconf.rb)
|
13
13
|
s.extra_rdoc_files = IO.readlines('.document').map!(&:chomp!).keep_if do |f|
|
14
14
|
File.exist?(f)
|
15
15
|
end
|
16
16
|
s.files = manifest
|
17
|
-
s.homepage = 'https://
|
17
|
+
s.homepage = 'https://yhbt.net/raindrops/'
|
18
18
|
s.summary = 'real-time stats for preforking Rack servers'
|
19
19
|
s.required_ruby_version = '>= 1.9.3'
|
20
20
|
s.test_files = test_files
|
data/test/ipv6_enabled.rb
CHANGED
@@ -2,8 +2,8 @@ def ipv6_enabled?
|
|
2
2
|
tmp = TCPServer.new(ENV["TEST_HOST6"] || '::1', 0)
|
3
3
|
tmp.close
|
4
4
|
true
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
rescue => e
|
6
|
+
warn "skipping IPv6 tests, host does not seem to be IPv6 enabled:"
|
7
|
+
warn " #{e.class}: #{e}"
|
8
|
+
false
|
9
9
|
end
|
data/test/test_linux.rb
CHANGED
@@ -76,6 +76,7 @@ def test_unix_all_unused
|
|
76
76
|
|
77
77
|
assert_equal 0, stats[tmp.path].active
|
78
78
|
assert_equal 0, stats[tmp.path].queued
|
79
|
+
us.close
|
79
80
|
end
|
80
81
|
|
81
82
|
def test_unix_resolves_symlinks
|
@@ -151,8 +152,8 @@ def test_tcp_reuse_sock
|
|
151
152
|
assert_equal 1, stats.size
|
152
153
|
assert_equal 0, stats[addr].queued
|
153
154
|
assert_equal 1, stats[addr].active
|
154
|
-
|
155
|
-
|
155
|
+
ensure
|
156
|
+
nlsock.close
|
156
157
|
end
|
157
158
|
|
158
159
|
def test_tcp_multi
|
data/test/test_raindrops.rb
CHANGED
@@ -134,7 +134,7 @@ def test_resize_mremap
|
|
134
134
|
assert_equal 0, rd[rd.capa - 1]
|
135
135
|
assert_equal 1, rd.incr(rd.capa - 1)
|
136
136
|
assert_raises(ArgumentError) { rd[rd.capa] }
|
137
|
-
|
137
|
+
rescue RangeError
|
138
138
|
end # if RUBY_PLATFORM =~ /linux/
|
139
139
|
|
140
140
|
def test_evaporate
|
data/test/test_tcp_info.rb
CHANGED
@@ -60,10 +60,10 @@ def test_tcp_server_delayed
|
|
60
60
|
a = s.accept
|
61
61
|
i = Raindrops::TCP_Info.new(a)
|
62
62
|
assert i.last_data_recv >= delay_ms, "#{i.last_data_recv} < #{delay_ms}"
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
ensure
|
64
|
+
c.close if c
|
65
|
+
a.close if a
|
66
|
+
s.close
|
67
67
|
end
|
68
68
|
|
69
69
|
def test_tcp_server_state_closed
|
data/test/test_watcher.rb
CHANGED
@@ -118,28 +118,28 @@ def test_tail_queued_min
|
|
118
118
|
|
119
119
|
def test_x_current_header
|
120
120
|
env = @req.class.env_for "/active/#@addr.txt"
|
121
|
-
|
121
|
+
_status, headers, _body = @app.call(env)
|
122
122
|
assert_equal "0", headers["X-Current"], headers.inspect
|
123
123
|
|
124
124
|
env = @req.class.env_for "/queued/#@addr.txt"
|
125
|
-
|
125
|
+
_status, headers, _body = @app.call(env)
|
126
126
|
assert_equal "1", headers["X-Current"], headers.inspect
|
127
127
|
|
128
128
|
@ios << @srv.accept
|
129
129
|
sleep 0.1
|
130
130
|
|
131
131
|
env = @req.class.env_for "/queued/#@addr.txt"
|
132
|
-
|
132
|
+
_status, headers, _body = @app.call(env)
|
133
133
|
assert_equal "0", headers["X-Current"], headers.inspect
|
134
134
|
|
135
135
|
env = @req.class.env_for "/active/#@addr.txt"
|
136
|
-
|
136
|
+
_status, headers, _body = @app.call(env)
|
137
137
|
assert_equal "1", headers["X-Current"], headers.inspect
|
138
138
|
end
|
139
139
|
|
140
140
|
def test_peaks
|
141
141
|
env = @req.class.env_for "/active/#@addr.txt"
|
142
|
-
|
142
|
+
_status, headers, _body = @app.call(env.dup)
|
143
143
|
start = headers["X-First-Peak-At"]
|
144
144
|
assert headers["X-First-Peak-At"], headers.inspect
|
145
145
|
assert headers["X-Last-Peak-At"], headers.inspect
|
@@ -148,14 +148,14 @@ def test_peaks
|
|
148
148
|
before = headers["X-Last-Peak-At"]
|
149
149
|
|
150
150
|
env = @req.class.env_for "/queued/#@addr.txt"
|
151
|
-
|
151
|
+
_status, headers, _body = @app.call(env)
|
152
152
|
assert_nothing_raised { Time.parse(headers["X-First-Peak-At"]) }
|
153
153
|
assert_nothing_raised { Time.parse(headers["X-Last-Peak-At"]) }
|
154
154
|
assert_equal before, headers["X-Last-Peak-At"], "should not change"
|
155
155
|
|
156
156
|
sleep 2
|
157
157
|
env = @req.class.env_for "/active/#@addr.txt"
|
158
|
-
|
158
|
+
_status, headers, _body = @app.call(env.dup)
|
159
159
|
assert_equal before, headers["X-Last-Peak-At"], headers.inspect
|
160
160
|
|
161
161
|
@ios << @srv.accept
|
@@ -167,7 +167,7 @@ def test_peaks
|
|
167
167
|
end
|
168
168
|
sleep 0.1
|
169
169
|
env = @req.class.env_for "/queued/#@addr.txt"
|
170
|
-
|
170
|
+
_status, headers, _body = @app.call(env.dup)
|
171
171
|
assert headers["X-Last-Peak-At"], headers.inspect
|
172
172
|
assert_nothing_raised { Time.parse(headers["X-Last-Peak-At"]) }
|
173
173
|
assert before != headers["X-Last-Peak-At"]
|
@@ -177,7 +177,7 @@ def test_peaks
|
|
177
177
|
sleep 2
|
178
178
|
|
179
179
|
env = @req.class.env_for "/queued/#@addr.txt"
|
180
|
-
|
180
|
+
_status, headers, _body = @app.call(env)
|
181
181
|
assert_equal "0", headers["X-Current"]
|
182
182
|
assert_nothing_raised { Time.parse(headers["X-Last-Peak-At"]) }
|
183
183
|
assert_equal queued_before, headers["X-Last-Peak-At"], "should not change"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raindrops
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.19.
|
4
|
+
version: 0.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- raindrops hackers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aggregate
|
@@ -78,7 +78,7 @@ description: |-
|
|
78
78
|
should support any Rack HTTP server on platforms supporting POSIX shared
|
79
79
|
memory. It may also be used as a generic scoreboard for sharing atomic
|
80
80
|
counters across multiple processes.
|
81
|
-
email: raindrops-public@
|
81
|
+
email: raindrops-public@yhbt.net
|
82
82
|
executables: []
|
83
83
|
extensions:
|
84
84
|
- ext/raindrops/extconf.rb
|
@@ -149,7 +149,7 @@ files:
|
|
149
149
|
- test/test_struct.rb
|
150
150
|
- test/test_tcp_info.rb
|
151
151
|
- test/test_watcher.rb
|
152
|
-
homepage: https://
|
152
|
+
homepage: https://yhbt.net/raindrops/
|
153
153
|
licenses:
|
154
154
|
- LGPL-2.1+
|
155
155
|
metadata: {}
|
@@ -168,8 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: '0'
|
170
170
|
requirements: []
|
171
|
-
|
172
|
-
rubygems_version: 2.6.12
|
171
|
+
rubygems_version: 3.0.2
|
173
172
|
signing_key:
|
174
173
|
specification_version: 4
|
175
174
|
summary: real-time stats for preforking Rack servers
|