Eric Wong [Sat, 23 Mar 2024 17:30:41 +0000 (23 17:30 +0000)]
README: update with extra disclaimer
Covering my ass from draconian legislation.
Eric Wong [Sat, 30 Mar 2024 18:03:54 +0000 (30 18:03 +0000)]
khashl: avoid multiplication overflow + memset
Instead of a malloc where arguments can silently overflow,
use calloc directly to handle the overflow and zeroing for
us.
Eric Wong [Sun, 24 Mar 2024 00:26:53 +0000 (24 00:26 +0000)]
linux_inet_diag: avoid errors for users compiling w/o assertions
We should warn gracefully when we hit IPv7+ or whatever...
Eric Wong [Sun, 24 Mar 2024 21:10:43 +0000 (24 21:10 +0000)]
khashl: use ruby_xrealloc2 to avoid overflow
While no user is likely to have enough listeners to trigger an
overflow, just use ruby_xrealloc2 to be safe since it's already
provided by Ruby (and AFAIK reallocarray(3) isn't standardized).
Eric Wong [Sun, 24 Mar 2024 00:19:18 +0000 (24 00:19 +0000)]
use switch to khashl for hash table outside of GVL
Given the history of Ruby removing public C APIs, get ahead
of potential incompatibilities by switching to an externally
maintained unordered hash table.
khashl is a newer, more memory-efficient evolution of the
khash hash table adopted by the git SCM and this will be
my first (and likely not last) time using it in a public
codebase.
Eric Wong [Sun, 24 Mar 2024 00:19:17 +0000 (24 00:19 +0000)]
linux_inet_diag: remove needless OBJ_FREEZE calls
OBJ_FREEZE before calling rb_hash_aset was actually preventing
deduplication since Ruby 2.6. This introduces a performance
regression for Ruby 2.5 users, but I expect the majority of
users are on newer versions (I'm on 2.7, which is still ancient).
Eric Wong [Thu, 8 Feb 2024 11:58:58 +0000 (8 11:58 +0000)]
treewide: future-proof frozen_string_literal changes
Once again Ruby seems ready to introduce more incompatibilities
and force busywork upon maintainers[1]. In order to avoid
incompatibilities in the future, I used the following Perl
script to prepend `frozen_string_literal: false' to every
Ruby file:
use v5.12;
use autodie;
my $usage = 'perl /path/to/script <LIST_OF_RB_FILES>';
my $fsl = "# frozen_string_literal: false\n";
for my $f (@ARGV) {
open my $fh, '<', $f;
my $s = do { local $/; <$fh> } // die "read($f): $!";
next if $s =~ /^#\s*frozen_string_literal:/sm;
# fsl must be after encoding: line if it exists:
if ($s =~ s/^([ \t]*\#[ \t\-\*\#]+encoding:[^\n]+\n)/$1$fsl/sm
# or after the shebang
|| $s =~ s/^(#![^\n]+\n)/$1$fsl/
# or after embedded switches in rackup files:
|| ($f =~ /\.ru$/ &&
$s =~ s/^(#\\[^\n]+\n)/$1$fsl/)
# or prepend as a last resort:
|| (substr($s, 0, 0) = $fsl)) {
open $fh, '>', $f;
print $fh $s;
close $fh;
}
}
Somebody interested will have to go through every Ruby source
file and enable frozen_string_literal once they've thoroughly
verified it's safe to do so.
[1] https://bugs.ruby-lang.org/issues/20205
Eric Wong [Fri, 29 Dec 2023 17:50:21 +0000 (29 17:50 +0000)]
gemspec: support rack 3.x
Hopefully this doesn't cause more breakage and we'll never
actually need a rack 4
Eric Wong [Fri, 29 Dec 2023 17:50:20 +0000 (29 17:50 +0000)]
extconf: disable optimization to speed up checks by ~3%
Compiler optimization isn't useful when doing portability checks
for any of the things we care about.
Eric Wong [Fri, 29 Dec 2023 17:50:19 +0000 (29 17:50 +0000)]
test/test_last_data_recv: don't require posix_mq
posix_mq is rarely installed, so don't force users to
have it in order to test or develop raindrops.
Eric Wong [Fri, 29 Dec 2023 17:50:18 +0000 (29 17:50 +0000)]
tests: support running tests without rack||aggregate
Diskspace and bandwidth are expensive, and we can make
rack+aggregate optional in tests, too.
Eric Wong [Fri, 29 Dec 2023 17:44:18 +0000 (29 17:44 +0000)]
middleware: reuse inet_diag netlink socket
Eric Wong <bofh@yhbt.net> wrote:
> I'll squash this in for fork+preload safety.
I forget there are multithreaded servers using this :x
------8<-----
Subject: [PATCH v3] middleware: reuse inet_diag netlink socket
No point in constantly allocating and deallocating FDs (and Ruby
IO objects) when reusing them is supported.
However, we must guard it against parallel callers since
linux_inet_diag.c::diag releases the GVL while calling
sendmsg(2) and recvmsg(2), so it's possible two Ruby threads can
end up crossing streams if the middlware is used with a
multi-threaded server.
AFAIK, Raindrops::Middleware isn't a heavily-trafficked endpoint,
so saving FDs and avoiding thread specific data is preferable
for memory-constrained systems I use.
Jean Boussier [Tue, 26 Sep 2023 21:40:00 +0000 (26 21:40 +0000)]
tcp_listener_stats: always eagerly close sockets
I just debugged an issue with our system, I was witnessing the
number of file descriptor in our process grow at an alarming rate
which I mapped to our use of raindrops to report utilisation.
For various reasons we don’t call raindrops from a Rack middleware
but have one process that monitor the socket continuously, and
share that data with the workers.
Since we call tcp_listener_stats every seconds in a process
that doesn't do much else, GC very rarely triggers if at all
which cause `InetDiagSocket` instances to accumulate very
quickly.
Each of those instances holds a file descriptor.
Looking at the raindrops implementation it seems to assume
the GC will take care of regularly closing these sockets, but
I think it’s a bit too bold of an assumption.
[ew: don't close user-passed sockets on exception]
Acked-by: Eric Wong <e@80x24.org>
Eric Wong [Tue, 5 Sep 2023 11:46:45 +0000 (5 11:46 +0000)]
aggregate/last_data_recv: support Socket#accept{,_nonblock}
Socket#accept and Socket#accept_nonblock return an Addrinfo
object in addition to a client socket. This allows web servers
to avoid having to make getpeername(2) syscalls to get the
same information.
Eric Wong [Sun, 11 Jun 2023 21:33:28 +0000 (11 21:33 +0000)]
test_linux_reuseport_tcp_listen_stats: skip w/o unicorn
We don't list `unicorn' as a development dependency since
unicorn currently depends on this project. While unicorn might
drop us as a dependency, don't waste disk space and bandwidth
of potential raindrops hackers who don't have unicorn.
Eric Wong [Sun, 11 Jun 2023 21:33:27 +0000 (11 21:33 +0000)]
linux_inet_diag: get rid of alloca usage
alloca makes stack usage unpredictable and life difficult for
static analysis tools and compilers. The 46 bytes of
INET6_ADDRSTRLEN is fine to keep on stack, but page size can be
several MB large in some architectures (but typically 4K on
common architectures).
Thus we handle page size-ed allocations via `rb_str_tmp_new'.
`rb_str_tmp_new' has been in public Ruby headers since the 1.9
days and used by the core `zlib', `digest', and `zlib'
extensions, so it should be safe to use (and `rb_str_resize' is
used in many more C extensions).
Eric Wong [Sun, 11 Jun 2023 21:33:26 +0000 (11 21:33 +0000)]
my_fileno: use rb_io_check_closed for Ruby <3.1
This is less code and hopefully smaller binaries.
`rb_io_check_closed' has been in Ruby since the pre-CVS of
decades ago, and it doesn't matter if it's removed or not
in the future since Ruby 3.1+ doesn't see this code path
and calls `rb_io_descriptor' directly.
Eric Wong [Sun, 11 Jun 2023 21:33:25 +0000 (11 21:33 +0000)]
avoid unnecessary #to_io calls
Calling `#to_io' is only necessary when we're handling an argument
from user code where the user could pass a non-IO object.
`#to_io' calls are a waste of time when we create the IO object
ourselves (in `Raindrops::InetDiagSock.new').
This allows us to define the `my_fileno' macro for Ruby 3.1+
users to call the new `rb_io_descriptor' function directly
without an extra C stack frame. This also allows us to get
rid of nesting CPP directives inside C functions which (IMHO)
improves readability.
Furthermore, any necessary #to_io calls using `rb_convert_type'
can be replaced with `rb_io_get_io' to decrease code size.
`rb_io_get_io' has been in ruby/io.h since Ruby 1.9.2 and
there's no expectation that it'd be deprecated since it only
deals with opaque `VALUE' types.
Samuel Williams [Fri, 9 Jun 2023 10:48:05 +0000 (9 19:48 +0900)]
Improve compatibility with Ruby 3.3+
Prefer to use `rb_io_descriptor` in my_fileno if it is available. This
function was introduced in Ruby 3.1. Ruby 3.3 will deprecate access to
all internal fields of `rb_io_t`.
This change is necessary for compatibility with the current
ruby.git master:
https://bugs.ruby-lang.org/issues/19057#note-17
Eric Wong [Thu, 9 Mar 2023 01:50:01 +0000 (9 01:50 +0000)]
my_fileno: drop Ruby 1.8 support and simplify
This project has been 1.9.3+ only for a long time (and likely
going 2.x+-only), so kill some code we don't need.
Eric Wong [Sat, 25 Feb 2023 00:15:56 +0000 (25 00:15 +0000)]
raindrops 0.20.1
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
Dale Hamel [Fri, 24 Feb 2023 18:47:40 +0000 (24 13:47 -0500)]
Fix off by one error in test
It doesn't affect the test outcome, but it is not the intended behaviour of
the test.
We listen once to find out what port to use, then should bind with SO_REUSEPORT
N-1 times, but we are doing it N times, so we have one extra listener.
Dale Hamel [Fri, 24 Feb 2023 18:35:44 +0000 (24 13:35 -0500)]
Fix queue stats for sockets with SO_REUSEPORT
SO_REUSEPORT was introduced in 2013, see https://lwn.net/Articles/542629/.
However, the current logic for calculating socket queue backlog stats
is from 2011, predating the advent of SO_REUSEPORT.
The current strategy was thus written before the notion that the mapping of
INET_ADDR:socket could potentially be 1:N instead of always 1:1.
This causes raindrops to provide invalid socket backlog values when
SO_REUSEPORT is used, which Unicorn supports since 2013. The current behaviour
will set the queue metric to the queue depth of the last inet_diag_msg
it processes matching the INET_ADDR. In practice, this will result in
the backlog being off by a factor N, assuming relatively even
distribution of requests to sockets, which the kernel should guarantee
through consistent hashing.
The fix here is to accumulate the socket queue depth as we iterate
over the the socket diagnostics, rather than reset it each time.
I have a provided a test, but it only checks the queues, not the
accept metrics, as those are not affected by this bug, and it is
not possible to know which of the listeners will be dispatched the
request by the kernel, and thus which should call accept.
Eric Wong [Mon, 6 Dec 2021 23:38:39 +0000 (6 23:38 +0000)]
raindrops 0.20.0
Raindrops may now use file-backed mmap() rather than anonymous
memory. Thanks to KJ Tsanaktsidis for the patch:
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).
Eric Wong [Tue, 30 Nov 2021 06:17:35 +0000 (30 06:17 +0000)]
doc: update with IMAP(S) URLs and improve descriptions
Our server on yhbt.net runs an IMAP(S) which is accessible over
Tor, too.
We no longer advertise a "mailing list" since the subscriber
info is centralized and not easily reproducible by third-parties.
Thus we focus on making our archives easily mirror-able via
IMAP(S), NNTP(S) and HTTP(S).
KJ Tsanaktsidis [Thu, 25 Nov 2021 06:56:19 +0000 (25 17:56 +1100)]
Allow Raindrops objects to be backed by a file
Currently, all memory used by Raindrops is mapped as MAP_ANONYMOUS. This
means that although Raindrops counters can be shared between processes
that have forked from each other, it is not possible to share the
counter values with another, unrelated process.
This patch adds support for backing the Raindrops mapping with a file
descriptor obtained from an IO object. The #initialize API has been
enhanced with two new keyword options:
Raindrops.new(size, io: nil, zero: false)
If an instance of IO is provided, then the underlying file descriptor
for that IO will be used to back the memory mapping Raindrops creates.
An unrelated process can then open the same file, and read the counters;
either by mmap'ing the file itself (or using Raindrops to do so), or by
making ordinary seek()/read() calls if performance is not a concern.
Note that the provided IO object _must_ implement #truncate; this is
used to set the size of the file to be right-sized for the memory
mapping that is created.
If the zero argument is passed as true, then the mapping will be zero'd
by Raindrops as part of its initialization. If it's false, then the
Raindrops counters existing in the file will be preserved. This allows
counter values to be persisted (although note that Raindrops makes no
attempt to msync the values, so they are not durable to e.g. system
crashes).
Counter values can easily be shared between processes
in-memory only without touching the disk by passing in a File on a
tmpfs as the io object.
Eric Wong [Tue, 25 May 2021 23:07:44 +0000 (25 23:07 +0000)]
raindrops 0.19.2
This release fixes compatibility with GC.compact on Ruby 3.x
when using ListenStats on Linux. The listener stats
functionality is rarely used and does not affect most users
who just have raindrops installed for shared atomic counters.
Eric Wong [Tue, 25 May 2021 22:59:47 +0000 (25 22:59 +0000)]
pkg.mk: remove index.html and created.rid from homepage
index.html and README.html are identical, so get rid of
it. created.rid has no business being public, anyways.
Our homepage is just a directory listing, nowadays,
to improve discoverability of non-HTML docs.
Eric Wong [Tue, 25 May 2021 22:57:41 +0000 (25 22:57 +0000)]
doc: use Tor v3 .onion URLs
Tor is dropping v2 .onion in favor of more secure (but less
readable) v3 .onion URLs. Zooko's triangle once again :/
(no, we won't support planet-destroying proof-of-work schemes)
Eric Wong [Tue, 25 May 2021 22:21:19 +0000 (25 22:21 +0000)]
mark ListenStats in C ext for GC.compact
With GC.compact in Ruby 3.x, Ruby-defined constants need to be
explicitly marked to prevent movement.
Link: https://yhbt.net/kgio-public/CAAvYYt5Z5f2rMuXO5DMpR1-6uRvu_gXKDvqcyoZ+oNcLiTH39g@mail.gmail.com/T/
Eric Wong [Wed, 8 Jan 2020 09:29:57 +0000 (8 09:29 +0000)]
raindrops 0.19.1
This release fixes some warnings on newer Rubies.
We're no longer on bogomips.org since it's due
for expiry and I can't pay extortionists for a .org, so
s/bogomips.org/yhbt.net/ for now, and be prepared to move again
when extortionists move onto extorting the .net TLD.
doc: switch homepage to dark216
ext/raindrops/extconf: fix cflags reset on ancient CC
fixes for newer rubies
replace bogomips.org with yhbt.net
Eric Wong [Mon, 6 Jan 2020 09:54:51 +0000 (6 09:54 +0000)]
replace bogomips.org with yhbt.net
The expiration for bogomips.org is coming up and I'm not
keen on paying or supporting extortionists.
Not wanting to be beholden to ICANN or any powerful
organizations, .onion sites are available to Tor users:
http://raindrops.ou63pmih66umazou.onion/
http://ou63pmih66umazou.onion/raindrops.git/
http://ou63pmih66umazou.onion/raindrops-public/
(the demo is not yet available via .onion, yet, could be a bit)
Eric Wong [Mon, 6 Jan 2020 09:54:50 +0000 (6 09:54 +0000)]
fixes for newer rubies
Newer rubies have more warnings
Eric Wong [Mon, 6 Jan 2020 09:54:49 +0000 (6 09:54 +0000)]
ext/raindrops/extconf: fix cflags reset on ancient CC
Oops, but I guess nobody uses i386 anymore...
Eric Wong [Mon, 22 Apr 2019 02:11:40 +0000 (22 02:11 +0000)]
doc: switch homepage to dark216
Earth Day!
https://80x24.org/olddoc-public/
20190422014906.4253-1-e@80x24.org/
Eric Wong [Wed, 9 Aug 2017 23:46:08 +0000 (9 23:46 +0000)]
raindrops 0.19.0 - Rack 2.x middleware compatibility
This release fixes Rack 2.x compatibility for the few users of
Raindrops::Middleware
<https://bogomips.org/raindrops/Raindrops/Middleware.html>.
Thanks to Dmytro Shteflyuk for this release.
No need to upgrade unless you use Raindrops::Middleware with
Rack 2.x.
There's also a few minor, inconsequential cleanups.
Dmytro Shteflyuk (1):
Properly override respond_to? in Raindrops::Middleware::Proxy
Eric Wong (2):
Ruby thread compatibility updates
tcp_info: remove unnecessary extconf.h include
Dmytro Shteflyuk [Tue, 25 Jul 2017 20:02:42 +0000 (25 16:02 -0400)]
Properly override respond_to? in Raindrops::Middleware::Proxy
Correct method definition according to Ruby documentation (https://ruby-doc.org/core-2.4.1/Object.html#method-i-respond_to-3F) is:
respond_to?(string, include_all=false) → true or false
Rack started using second argument starting from version 2:
https://github.com/rack/rack/blob/master/lib/rack/body_proxy.rb#L14
If raindrops is used in Rack 2+ applications, an exception is raised:
ArgumentError: wrong number of arguments (2 for 1)
<ROOT>/gems/raindrops-0.18.0/lib/raindrops/middleware/proxy.rb:30:in `respond_to?'
<ROOT>/gems/rack-2.0.3/lib/rack/body_proxy.rb:14:in `respond_to?'
Eric Wong [Wed, 26 Apr 2017 02:56:50 +0000 (26 02:56 +0000)]
tcp_info: remove unnecessary extconf.h include
ruby.h already pulls in extconf.h and has done so since Ruby 1.8.
Eric Wong [Wed, 26 Apr 2017 01:10:59 +0000 (26 01:10 +0000)]
Ruby thread compatibility updates
Drop vestigial Ruby 1.8 bits, and start using
rb_thread_call_without_gvl on modern Rubies.
Eric Wong [Thu, 23 Mar 2017 02:21:55 +0000 (23 02:21 +0000)]
raindrops 0.18.0
The most notable feature of this release is the addition of
FreeBSD and OpenBSD TCP_INFO support. This includes the
Raindrops::TCP for portably mapping TCP state names to
platform-dependent numeric values:
https://bogomips.org/raindrops/Raindrops.html#TCP
Thanks to Jeremy Evans and Simon Eskildsen on the
unicorn-public@bogomips.org mailing list for inspiring
these changes to raindrops.
There's also a few internal cleanups, and documentation
improvements, including some fixes to the largely-forgotten
Raindrops::Aggreage::PMQ class:
https://bogomips.org/raindrops/Raindrops/Aggregate/PMQ.html
20 changes since 0.17.0:
test_inet_diag_socket: fix Fixnum deprecation warning
TODO: add item for IPv6 breakage
ext: fix documentation for C ext-defined classes
TCP_Info: custom documentation for #get!
TypedData C-API conversion
test_watcher: disable test correctly when aggregate is missing
tcp_info: support this struct under FreeBSD
define Raindrops::TCP hash for TCP states
linux_inet_diag: reduce stack usage and simplify
avoid reading errno repeatedly
aggregate/pmq: avoid false sharing of lock buffers
aggregate/pmq: remove io-extra requirement
aggregate/pmq: avoid File#stat allocation
Merge remote-tracking branch 'origin/freebsd'
Merge remote-tracking branch 'origin/aggregate-pmq'
doc: remove private email support address
doc: update location of TCP_INFO-related stuff
build: avoid olddoc for building the RubyGem
doc: document Raindrops::TCP hash
aggregate/pmq: update version numbers for Ruby and Linux
Eric Wong [Thu, 23 Mar 2017 02:41:40 +0000 (23 02:41 +0000)]
aggregate/pmq: update version numbers for Ruby and Linux
Linux is in the 4.x and Ruby is into the 2.x range, by now,
so try to get with the times.
Eric Wong [Thu, 23 Mar 2017 02:33:17 +0000 (23 02:33 +0000)]
doc: document Raindrops::TCP hash
This is part of the stable API, so we shall document it for
others to use.
Eric Wong [Thu, 23 Mar 2017 02:18:13 +0000 (23 02:18 +0000)]
build: avoid olddoc for building the RubyGem
This should make it easier for distros to pick this
without picking up olddoc, too.
We will still use olddoc for generating the website since it
reduces bandwidth costs, and for generating NEWS for our own
builds.
Eric Wong [Thu, 23 Mar 2017 02:16:34 +0000 (23 02:16 +0000)]
doc: update location of TCP_INFO-related stuff
Eric Wong [Mon, 20 Mar 2017 20:44:47 +0000 (20 20:44 +0000)]
doc: remove private email support address
Email was never private, and won't further burden myself or
any future maintainers with trying to maintain someone elses'
privacy.
Offering private support is also unfair to readers on public
lists who may get a watered down or improperly translated
summary (if at all).
Instead, encourage the use of anonymity tools and scrubbing of
sensitive information when the sender deems necessary.
Eric Wong [Sat, 18 Mar 2017 01:32:23 +0000 (18 01:32 +0000)]
Merge remote-tracking branch 'origin/aggregate-pmq'
* origin/aggregate-pmq:
aggregate/pmq: avoid File#stat allocation
aggregate/pmq: remove io-extra requirement
aggregate/pmq: avoid false sharing of lock buffers
Eric Wong [Sat, 18 Mar 2017 01:32:19 +0000 (18 01:32 +0000)]
Merge remote-tracking branch 'origin/freebsd'
* origin/freebsd:
define Raindrops::TCP hash for TCP states
tcp_info: support this struct under FreeBSD
Eric Wong [Thu, 16 Mar 2017 03:14:12 +0000 (16 03:14 +0000)]
aggregate/pmq: avoid File#stat allocation
File#size is available in modern Rubies so the extra syscall
is avoided.
Eric Wong [Thu, 16 Mar 2017 03:14:11 +0000 (16 03:14 +0000)]
aggregate/pmq: remove io-extra requirement
IO.copy_stream is standard in 1.9+ and can use pread when
given an offset. We do not need to use pwrite with fcntl
locking, actually.
Eric Wong [Thu, 16 Mar 2017 03:14:10 +0000 (16 03:14 +0000)]
aggregate/pmq: avoid false sharing of lock buffers
And rely on frozen string optimizations in Ruby while we're at it.
Eric Wong [Fri, 17 Mar 2017 01:57:34 +0000 (17 01:57 +0000)]
avoid reading errno repeatedly
errno is in the thread-specific section and it is slightly
cheaper to read it once rather than twice. Recent versions
of mainline Ruby itself follows the same pattern.
Eric Wong [Fri, 17 Mar 2017 23:46:42 +0000 (17 23:46 +0000)]
linux_inet_diag: reduce stack usage and simplify
getnameinfo is overkill for NI_NUMERICHOST + NI_NUMERICSERV usage,
and has a more complex and error-prone API than using inet_ntop
and snprintf.
Eric Wong [Thu, 16 Mar 2017 03:16:52 +0000 (16 03:16 +0000)]
define Raindrops::TCP hash for TCP states
FreeBSD not only uses different values than Linux for TCP
states, but different names, too. To ease writing portable code
between the OSes, do more CPP metaprogramming via extconf.rb
and define a common hash supported on both OSes.
Putting all this in a hash allows for easy dumping and mapping
in an OS-neutral way, since the actual TCP states are
OS-independent.
Eric Wong [Thu, 16 Mar 2017 03:16:51 +0000 (16 03:16 +0000)]
tcp_info: support this struct under FreeBSD
Of course these fields are not portable between Linux and FreeBSD,
but they should remain ABI-compatible for future versions of each OS.
Tested on FreeBSD 10.3-RELEASE i386
TCP state names will be another problem...
Eric Wong [Wed, 15 Mar 2017 23:39:46 +0000 (15 23:39 +0000)]
test_watcher: disable test correctly when aggregate is missing
While we're at it, improve the description of other skips.
Eric Wong [Tue, 14 Mar 2017 20:01:18 +0000 (14 20:01 +0000)]
TypedData C-API conversion
This provides some extra type safety if combined with other
C extensions, as well as allowing us to account for memory usage of
the HTTP parser in ObjectSpace.
This requires Ruby 1.9.3+ and has remained a stable API since
then. This will become officially supported when Ruby 2.3.0 is
released later this month.
This API has only been documented in doc/extension.rdoc (formerly
README.EXT) in the Ruby source tree since April 2015, r50318
Eric Wong [Wed, 1 Mar 2017 02:48:40 +0000 (1 02:48 +0000)]
TCP_Info: custom documentation for #get!
While #get! is the same as the #initialize method,
the former is public and called explicitly by folks
wishing to reduce allocation overhead.
Eric Wong [Wed, 1 Mar 2017 02:34:24 +0000 (1 02:34 +0000)]
ext: fix documentation for C ext-defined classes
Defining the "Raindrops" class explicitly helps RDoc find
subclasses for documentation, and ought to reduce the binary
size slightly due to the removal of rb_intern calls.
Furthermore, use "Socket" to ensure the base class for
Raindrops::InetDiagSocket is documented properly in RDoc.
Eric Wong [Thu, 23 Feb 2017 20:34:12 +0000 (23 20:34 +0000)]
TODO: add item for IPv6 breakage
I've noticed the IPv6 connections on
https://raindrops-demo.bogomips.org/ are not being reported
correctly. We will have to look into fixing it..
Eric Wong [Tue, 27 Sep 2016 02:21:02 +0000 (27 02:21 +0000)]
test_inet_diag_socket: fix Fixnum deprecation warning
Ruby 2.4 will unify Fixnum and Bignum.
Eric Wong [Fri, 29 Jul 2016 21:03:45 +0000 (29 21:03 +0000)]
raindrops 0.17.0 - rack 2.x updates
This release features minor updates to support rack 2.x
while maintaining support for rack 1.2 and later.
As a result, Ruby 1.8.6 compatibility is gone, but
Ruby 1.8.7 probably still works, for now.
There's also a minor warning fix, doc updates, and
the homepage now supports HTTPS (HTTP remains supported)
5 changes since raindrops 0.16.0:
drop Rack::Utils.bytesize dependency
gemspec: bump Rack dependency
linux_inet_diag: GCC attribute format check
use HTTPS and move homepage to https://bogomips.org/raindrops/
examples: add yahns config, zbatery is abandoned
Eric Wong [Sun, 31 Jul 2016 14:25:38 +0000 (31 14:25 +0000)]
examples: add yahns config, zbatery is abandoned
Since zbatery is abandoned, point users towards yahns
instead since that is what I currently use.
Eric Wong [Fri, 29 Jul 2016 22:35:46 +0000 (29 22:35 +0000)]
use HTTPS and move homepage to https://bogomips.org/raindrops/
While raindrops.bogomips.org exists, having extra subjectAltName
entries is bloating the certificate. This will make it easier
to mirror the homepage on Tor hidden services.
Eric Wong [Thu, 28 Jul 2016 00:02:02 +0000 (28 00:02 +0000)]
linux_inet_diag: GCC attribute format check
This helps the compiler detect bugs and
quiets down a -Wsuggest-attribute=format warning
Eric Wong [Thu, 28 Jul 2016 00:00:52 +0000 (28 00:00 +0000)]
gemspec: bump Rack dependency
We are now compatible with Rack 1.2 .. 2.x
Eric Wong [Wed, 27 Jul 2016 22:51:55 +0000 (27 22:51 +0000)]
drop Rack::Utils.bytesize dependency
rack 2.0 removes this method, but we actually don't need it
since any strings we generate are binary and Aggregate#to_s
output is 7-bit clean.
Eric Wong [Mon, 29 Feb 2016 12:22:32 +0000 (29 12:22 +0000)]
raindrops 0.16.0 - minor fixes and workarounds
There's mainly a fix/workaround for Ruby 2.3 now returning
locale-aware strings for File.readlink and our test suite
using strange paths allowed by *nix.
https://bugs.ruby-lang.org/issues/12034
tcp_listener_stats won't return "true" object placeholders
if stats are configured for a non-existent listener.
There are also minor optimizations for Ruby 2.2+ (at the expense
of 2.1 and earlier).
And the usual round of minor tweaks and doc updates.
10 changes since v0.15.0:
gemspec: avoid circular dependency on unicorn
remove optimizations which made sense for older rubies
linux: workaround Ruby 2.3 change
linux: remove Pathname stdlib dependency
add .gitattributes for Ruby method detection
middleware: minor bytecode size reduction
doc: update URLs and references
README: remove indentation from URLs in RDoc
linux: tcp_listener_stats drops "true" placeholders
build: use '--local' domain for dev gem install
Eric Wong [Tue, 2 Feb 2016 23:01:49 +0000 (2 23:01 +0000)]
build: use '--local' domain for dev gem install
This avoids unnecessary network requests for disconnected
systems.
Eric Wong [Thu, 25 Feb 2016 09:34:08 +0000 (25 09:34 +0000)]
linux: tcp_listener_stats drops "true" placeholders
With invalid addresses specified which give no currently-bound
address, we must avoid leaving placeholders ('true' objects)
in our results.
Clean up some shadowing "cur" while we're at it.
Eric Wong [Wed, 24 Feb 2016 03:51:57 +0000 (24 03:51 +0000)]
README: remove indentation from URLs in RDoc
RDoc considers indented text to be preformatted and
will not generate links in HTML links for them.
Eric Wong [Wed, 24 Feb 2016 02:27:26 +0000 (24 02:27 +0000)]
doc: update URLs and references
Neither the GCC nor libatomic_ops URLs are valid, anymore.
Update them to the latest versions and ensure the URLs themselves
are visible in documentation as links to external sites.
Additionally, the current cgit installation on bogomips.org will
soon be replaced by a CSS-free web-based viewer.
Also, correct the reference to "LGPL-2.1+" while we're at it
and add references to the nntp:// mail archives.
Eric Wong [Wed, 24 Feb 2016 01:44:21 +0000 (24 01:44 +0000)]
middleware: minor bytecode size reduction
The "defineclass" VM instruction takes more operands
and uses more space than "setconstant". Since we have no
methods or subclasses/constants to define under the
"Raindrops::Middleware::Stats" class,
Eric Wong [Wed, 24 Feb 2016 01:44:17 +0000 (24 01:44 +0000)]
add .gitattributes for Ruby method detection
The "diff" function detection for C does not map well to
Ruby files, take advantage of gitattributes(5) to improve
method name detection in generated patches as well as
making "git diff -W" output more useful.
Eric Wong [Tue, 23 Feb 2016 02:04:34 +0000 (23 02:04 +0000)]
linux: remove Pathname stdlib dependency
The File.readlink has been available since the earliest SVN import
of Ruby from Jan 16 1998. There's no reason to load the Pathname
class here since we don't do any further pathname manipulation.
So avoid loading the extra .so here and creating extra objects.
Eric Wong [Tue, 2 Feb 2016 18:31:36 +0000 (2 18:31 +0000)]
linux: workaround Ruby 2.3 change
File.readlink (and thus Pathname#realpath) returns the filesystem
encoding (Encoding.find "filesystem"). The filesystem encoding
defaults to the locale encoding, which tends to be UTF-8. This
is true even on *nix filesystems which can have any byte besides
"\0".
ref: https://bugs.ruby-lang.org/issues/12034
ref: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/73593
Eric Wong [Tue, 2 Feb 2016 21:35:30 +0000 (2 21:35 +0000)]
remove optimizations which made sense for older rubies
Since Ruby 2.2, frozen string literals are implied for Hash#[]
lookups. Constant lookups have inline caching since Ruby 1.9
(from YARV).
Eric Wong [Sat, 29 Aug 2015 06:43:08 +0000 (29 06:43 +0000)]
gemspec: avoid circular dependency on unicorn
We can skip tests which require unicorn.
Eric Wong [Wed, 22 Jul 2015 00:25:05 +0000 (22 00:25 +0000)]
raindrops 0.15.0 - non-glibc compat fix on Linux
Thanks to Doug Forster for sending us the report.
No other fixes
* check for the existence of linux/tcp.h
Eric Wong [Tue, 14 Jul 2015 20:08:49 +0000 (14 20:08 +0000)]
check for the existence of linux/tcp.h
The linux/tcp.h header may not exist on alternative libc
implementations such as musl.
Noticed-by: Doug Forster <doug.forster@gmail.com>
Eric Wong [Thu, 25 Jun 2015 21:43:57 +0000 (25 21:43 +0000)]
raindrops 0.14.0 - misc doc updates
Eric Wong (7):
linux_inet_diag: annotate memory freeing on diag errors
README: trim intro and update license
modernize packaging and documentation
move mailing list to raindrops-public@bogomips.org
linux_inet_diag: clarify *fprintf usage without GVL
TODO: add item for unix_diag and udp_diag
linux_inet_diag: fix Wshorten-64-to-32 warnings
Hleb Valoshka (1):
Add setup and teardown for ipv6 tests
Eric Wong [Wed, 14 Jan 2015 01:39:38 +0000 (14 01:39 +0000)]
linux_inet_diag: fix Wshorten-64-to-32 warnings
POSIX and glibc 2.2+ declare the hostlen and servlen
args of getnameinfo(3) to be socklen_t, not size_t,
so favor socklen_t for those calculations.
While we're at it, nlmsg_len is u32, too, so cast it
as such to avoid the warning.
Tested on clang version 3.5-1ubuntu1 on x86-64
Eric Wong [Wed, 14 Jan 2015 02:10:04 +0000 (14 02:10 +0000)]
TODO: add item for unix_diag and udp_diag
These features are found in newer kernels.
Eric Wong [Wed, 14 Jan 2015 00:09:00 +0000 (14 00:09 +0000)]
linux_inet_diag: clarify *fprintf usage without GVL
A reviewer may wonder why fprintf is chosen instead of rb_warn,
so make it clear we're outside of the GVL when spewing the
warning message and cannot use most rb_* functions.
Eric Wong [Tue, 13 Jan 2015 20:25:05 +0000 (13 20:25 +0000)]
move mailing list to raindrops-public@bogomips.org
Existing subscribers on librelist will need to resubscribe since
there's no published subscriber lists anywhere.
The public-inbox + mlmmj setup on bogomips.org allows posting
without subscription and offers downloadable archives via git.
The lack of rsyncable archives on librelist nowadays and
subscription-required nature of librelist are points against it.
Repliers should Cc: all recipients (using the reply-all
function of their mail client) since many readers are not
subscribed.
This project has never accepted or encouraged HTML email, but
librelist accepted it. The bogomips.org mail server is
configured to treat HTML mail as spam, so do not send HTML mail
if you expect a response.
Users who wish to subscribe may send a message to:
raindrops-public+subscribe@bogomips.org
Similarly, they may unsubscribe via:
raindrops-public+unsubscribe@bogomips.org
HTTP archives are available via:
http://bogomips.org/raindrops-public/
ssoma users may also use: git://bogomips.org/raindrops-public
(see README change)
Old messages to the librelist addresses will continue to
get routed to the new mailing list.
ref: http://public-inbox.org/
Eric Wong [Tue, 13 Jan 2015 19:43:05 +0000 (13 19:43 +0000)]
modernize packaging and documentation
By switching to olddoc!
wrongdoc was difficult to maintain due to FFI, and olddoc is
more complete anyways (no images or CSS, not just JavaScript
removal). While we're at it, use the SPDX-recommended license
abbreviation ("LGPL-2.1+") and specify a test-unit dependency.
ref: http://80x24.org/olddoc/
Eric Wong [Tue, 13 Jan 2015 20:30:05 +0000 (13 20:30 +0000)]
README: trim intro and update license
No need to mention Rainbows! anymore since it is stagnant,
and I've given up on Rubinius support since it requires
a proprietary bug tracker.
We went with LGPL-2.1+ in
commit
09fb7ccc3f1712411c61cbf54766c3c12c8296b2
but forgot to update the README.
Hleb Valoshka [Mon, 9 Sep 2013 19:03:58 +0000 (9 22:03 +0300)]
Add setup and teardown for ipv6 tests
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Eric Wong [Sun, 7 Sep 2014 06:53:14 +0000 (7 06:53 +0000)]
linux_inet_diag: annotate memory freeing on diag errors
Clarify the code so memory leak alarms in reviewers eyes do not go off.
Eric Wong [Tue, 18 Feb 2014 20:57:46 +0000 (18 20:57 +0000)]
raindrops 0.13.0 several minor fixes and improvements
Most notably, this release is necessary for Ruby 2.2 (dev).
Thanks to Koichi Sasada for the bug report!
Eric Wong (5):
Rakefile: remove raa_update task
last_data_recv: do not assume Unicorn includes all constants
raindrops.gemspec: add wrongdoc dev dependency
linux_inet_diag: fix Ruby 2.2 (dev) build
license: use LGPLv2.1 or later (was LGPL (2.1|3.0)-only)
Hleb Valoshka (1):
Remove Scope IDs from IPv6 addresses.
Eric Wong [Tue, 18 Feb 2014 08:11:31 +0000 (18 08:11 +0000)]
license: use LGPLv2.1 or later (was LGPL (2.1|3.0)-only)
There is currently no LGPLv4, so this change has no effect at the
moment.
In case the LGPLv4 arrives and I am not alive to approve/review it,
the lesser of evils is have give blanket approval of all future LGPL
versions (as published by the FSF). The worse evil is to be stuck
with a license which cannot guarantee the Free-ness of this project
in the future.
This unfortunately means the FSF can theoretically come out with
license terms I do not agree with, but the LGPLv2.1 and LGPLv3
will always remain an option to all users.
Eric Wong [Tue, 18 Feb 2014 06:48:36 +0000 (18 06:48 +0000)]
linux_inet_diag: fix Ruby 2.2 (dev) build
Do not define or use rb_thread_blocking_region if
rb_thread_io_blocking_region is available.
rb_thread_blocking_region is gone entirely in Ruby trunk.
Eric Wong [Tue, 18 Feb 2014 06:46:43 +0000 (18 06:46 +0000)]
raindrops.gemspec: add wrongdoc dev dependency
Ugh, I really need to work on an 80x24-friendly rdoc :P
Eric Wong [Tue, 5 Nov 2013 07:05:04 +0000 (5 07:05 +0000)]
last_data_recv: do not assume Unicorn includes all constants
Some projects may load parts of Unicorn and not others.
Eric Wong [Tue, 5 Nov 2013 07:00:26 +0000 (5 07:00 +0000)]
Rakefile: remove raa_update task
RAA is dead
Hleb Valoshka [Thu, 12 Sep 2013 13:31:13 +0000 (12 16:31 +0300)]
Remove Scope IDs from IPv6 addresses.
Scoped ipv6 addresses are defined in rfc4007.
Ruby doesn't support them yet and it's unknown whether it will
(see http://bugs.ruby-lang.org/issues/8464).
So we just remove scope ids.
Tested with MRI and Rubinius.
Eric Wong [Mon, 2 Sep 2013 10:30:39 +0000 (2 10:30 +0000)]
raindrops 0.12.0 - compatibility fixes
This release fixes builds on systems where compilers target i386
(and not later x86 systems). There are also minor improvements for
Ruby 2.1.0dev and Rubinius.
Eric Wong (5):
doc: add email address to generated doc/site
README: update regarding Ruby support status
extconf: try harder for gcc atomics in i386-configured systems
linux_inet_diag: improve compatibility with newer GCs
test_watcher: fix for Ruby trunk r40195 and later
Eric Wong [Mon, 2 Sep 2013 09:53:51 +0000 (2 09:53 +0000)]
test_watcher: fix for Ruby trunk r40195 and later
assert_raises doesn't capture exceptions the same way rescue works.
Eric Wong [Sun, 16 Jun 2013 20:54:55 +0000 (16 20:54 +0000)]
linux_inet_diag: improve compatibility with newer GCs
RARRAY_PTR is expensive with GCs in Ruby 2.1.0dev and Rubinius, so
use rb_ary_entry for non-performance critical paths. Eventually,
RARRAY_AREF/RARRAY_ASET may be common, but for now, using
rb_ary_entry should require the least cognitive overhead for a
developer.
Eric Wong [Wed, 28 Aug 2013 10:10:29 +0000 (28 10:10 +0000)]
extconf: try harder for gcc atomics in i386-configured systems
__sync_lock_test_and_set might not be the correct check after all,
but __sync_val_compare_and_swap probably is. At least this is
what Ruby 2.0.0 uses to check and attempt -march=i486 on.
Eric Wong [Sat, 20 Apr 2013 23:16:38 +0000 (20 23:16 +0000)]
README: update regarding Ruby support status
Now that Ruby 2.0.0 is out...