Age | Commit message (Collapse) | Author |
|
Issue - https://bugs.ruby-lang.org/issues/21436
Apparently, the lower bound check is missing, which results in overflow & wrapping later on in RB_INT2FIX
Signed-off-by: Dmitry Dygalo <[email protected]>
https://github.com/ruby/date/commit/67d75e8423
|
|
Addresses https://bugs.ruby-lang.org/issues/21437
Signed-off-by: Dmitry Dygalo <[email protected]>
https://github.com/ruby/date/commit/31f07bc576
|
|
* Add `open_timeout` as an overall timeout option for `Socket.tcp`
[Background]
Currently, `TCPSocket.new` and `Socket.tcp` accept two kind of timeout options:
- `resolv_timeout`, which controls the timeout for DNS resolution
- `connect_timeout`, which controls the timeout for the connection attempt
With the introduction of Happy Eyeballs Version 2 (as per [RFC 8305](https://datatracker.ietf.org/doc/html/rfc8305)) in[ Feature #20108](https://bugs.ruby-lang.org/issues/20108) and [Feature #20782](https://bugs.ruby-lang.org/issues/20782), both address resolution and connection attempts are now parallelized.
As a result, the sum of `resolv_timeout` and `connect_timeout` no longer represents the total timeout duration. This is because, in HEv2, name resolution and connection attempts are performed concurrently, causing the two timeouts to overlap.
Example:
When `resolv_timeout: 200ms` and `connect_timeout: 100ms` are set:
1. An IPv6 address is resolved after the method starts immediately (IPv4 is still being resolved).
2. A connection attempt is initiated to the IPv6 address
3. After 100ms, `connect_timeout` is exceeded. However, since `resolv_timeout` still has 100ms left, the IPv4 resolution continues.
4. After 200ms from the start, the method raises a `resolv_timeout` error.
In this case, the total elapsed time before a timeout is 200ms, not the expected 300ms (100ms + 200ms).
Furthermore, in HEv2, connection attempts are also parallelized.
It starts a new connection attempts every 250ms for resolved addresses. This makes the definition of `connect_timeout` even more ambiguous—specifically, it becomes unclear from which point the timeout is counted.
Additionally, these methods initiate new connection attempts every 250ms (Connection Attempt Delay) for each candidate address, thereby parallelizing connection attempts. However, this behavior makes it unclear from which point in time the connect_timeout is actually measured.
Currently, a `connect_timeout` is raised only after the last connection attempt exceeds the timeout.
Example:
When `connect_timeout: 100ms` is set and 3 address candidates:
1. Start a connection attempt to the address `a`
2. 250ms after step 1, start a new connection attempt to the address `b`
3. 500ms after step 1, start a new connection attempt to the address `c`
4. 1000ms after step 3 (1000ms after starting the connection to `c`, 1250ms after starting the connection to `b,` and 1500ms after starting the connection to `a`) `connect_timeout` is raised
This behavior aims to favor successful connections by allowing more time for each attempt, but it results in a timeout model that is difficult to reason about.
These methods have supported `resolv_timeout` and `connect_timeout` options even before the introduction of HEv2. However, in many use cases, it would be more convenient if a timeout occurred after a specified duration from the start of the method. Similar functions in other languages (such as PHP, Python, and Go) typically allow specifying only an overall timeout.
[Proposal]
I propose adding an `open_timeout` option to `Socket.tcp` in this PR, which triggers a timeout after a specified duration has elapsed from the start of the method.
The name `open_timeout` aligns with the existing accessor used in `Net::HTTP`.
If `open_timeout` is specified together with `resolv_timeout` and `connect_timeout`, I propose that only `open_timeout` be used and the others be ignored. While it is possible to support combinations of `open_timeout`, `resolv_timeout`, and `connect_timeout`, doing so would require defining which timeout takes precedence in which situations. In this case, I believe it is more valuable to keep the behavior simple and easy to understand, rather than supporting more complex use cases.
If this proposal is accepted, I also plan to extend `open_timeout` support to `TCPSocket.new`.
While the long-term future of `resolv_timeout` and `connect_timeout` may warrant further discussion, I believe the immediate priority is to offer a straightforward way to specify an overall timeout.
[Outcome]
If `open_timeout` is also supported by `TCPSocket.new`, users would be able to manage total connection timeouts directly in `Net::HTTP#connect` without relying on `Timeout.timeout`.
https://github.com/ruby/ruby/blob/aa0f689bf45352c4a592e7f1a044912c40435266/lib/net/http.rb#L1657
---
* Raise an exception if it is specified together with other timeout options
> If open_timeout is specified together with resolv_timeout and connect_timeout, I propose that only open_timeout be used and the others be ignored.
Since this approach may be unclear to users, I’ve decided to explicitly raise an `ArgumentError` if these options are specified together.
* Add doc
* Fix: open_timeout error should be raised even if there are still addresses that have not been tried
Notes:
Merged-By: shioimm <[email protected]>
|
|
https://github.com/ruby/date/commit/dbf4e957dc
|
|
This flag isn't really meant to be public, it's an implementation
detail of Ruby.
And checking it before calling `rb_copy_generic_ivar` only save
a function call.
https://github.com/ruby/date/commit/8175252653
|
|
This behave almost exactly as a T_OBJECT, the layout is entirely
compatible.
This aims to solve two problems.
First, it solves the problem of namspaced classes having
a single `shape_id`. Now each namespaced classext
has an object that can hold the namespace specific
shape.
Second, it open the door to later make class instance variable
writes atomics, hence be able to read class variables
without locking the VM.
In the future, in multi-ractor mode, we can do the write
on a copy of the `fields_obj` and then atomically swap it.
Considerations:
- Right now the `RClass` shape_id is always synchronized,
but with namespace we should likely mark classes that have
multiple namespace with a specific shape flag.
Notes:
Merged: https://github.com/ruby/ruby/pull/13411
|
|
(https://github.com/ruby/strscan/pull/158)
- `have_func` includes "ruby.h" by default.
- include "ruby/re.h" where `rb_reg_onig_match` is declared.
https://github.com/ruby/strscan/commit/1ac96f47e9
|
|
The type isn't opaque because Ruby isn't often compiled with LTO,
so for optimization purpose it's better to allow as much inlining
as possible.
However ideally only `shape.c` and `shape.h` should deal with
the actual struct, and everything else should just deal with opaque
`shape_id_t`.
Notes:
Merged: https://github.com/ruby/ruby/pull/13586
|
|
https://github.com/ruby/date/commit/b28617cde0
|
|
Now that we have the `heap_index` in shape flags we no longer
need `T_OBJECT` shapes.
Notes:
Merged: https://github.com/ruby/ruby/pull/13556
|
|
|
|
(https://github.com/ruby/strscan/pull/156)
StringScanner holds the string being scanned, and a regex for methods
like `match?`. Triggering the write barrier for those allows us to mark
this as WB protected.
https://github.com/ruby/strscan/commit/32fec70407
|
|
https://github.com/ruby/date/commit/6dd7969a64
|
|
|
|
`str_chilled_p`
(https://github.com/ruby/stringio/pull/136)
https://github.com/ruby/stringio/commit/3c52ddc4c8
|
|
`rb_addrinfo_t` has `VALUE inspectname` and `VALUE canonname`, so this
triggers the write barrier for those. The `AddrInfo` wasn't readily
available where we need to call `RB_OBJ_WRITE`, so this involves passing
`self` around a bit.
Notes:
Merged: https://github.com/ruby/ruby/pull/13503
|
|
Instead it's now a `shape_id` flag.
This allows to check if an object is complex without having
to chase the `rb_shape_t` pointer.
Notes:
Merged: https://github.com/ruby/ruby/pull/13511
|
|
Instead `shape_id_t` higher bits contain flags, and the first one
tells whether the shape is frozen.
This has multiple benefits:
- Can check if a shape is frozen with a single bit check instead of
dereferencing a pointer.
- Guarantees it is always possible to transition to frozen.
- This allow reclaiming `FL_FREEZE` (not done yet).
The downside is you have to be careful to preserve these flags
when transitioning.
Notes:
Merged: https://github.com/ruby/ruby/pull/13289
|
|
We should avoid conversions from `rb_shape_t *` into `shape_id_t`
outside of `shape.c` as the short term goal is to have `shape_id_t`
contain tags.
Notes:
Merged: https://github.com/ruby/ruby/pull/13448
|
|
https://github.com/ruby/json/commit/a29cb77d52
|
|
https://github.com/ruby/json/commit/8603a57a91
|
|
This would have caught https://github.com/ruby/json/pull/808
on CI.
https://github.com/ruby/json/commit/8109421fb4
|
|
negative floats.
Fix: https://github.com/ruby/json/issues/807
Since https://github.com/ruby/json/pull/800, `fpconv_dtoa` can actually
generate up to 28 chars.
https://github.com/ruby/json/commit/d73ae93d3c
|
|
Allow Addrinfo objects to be shared among Ractors. Addrinfo objects are
already immutable, so I think it's safe for us to tag them as
RUBY_TYPED_FROZEN_SHAREABLE shareable too.
Notes:
Merged: https://github.com/ruby/ruby/pull/13388
|
|
https://github.com/ruby/json/commit/7c03ffc3e0
|
|
https://github.com/ruby/json/commit/c060943d04
|
|
https://github.com/ruby/json/commit/f5c1b8c45d
|
|
https://github.com/ruby/json/commit/8433571dcf
|
|
If SSL_CTX_add_extra_chain_cert() fails, the refcount of x509 must be
handled by the caller. This should only occur due to a malloc failure
inside the function.
https://github.com/ruby/openssl/commit/80bcf727dc
|
|
OpenSSL::Cipher#encrypt and #decrypt have long supported a hidden
feature to derive a key and an IV from the String argument, but in an
inappropriate way.
This feature is undocumented, untested, and has been deprecated since
commit https://github.com/ruby/ruby/commit/0dc43217b189 on 2004-06-30,
which started printing a non-verbose warning. More than 20 years later,
it must be safe to remove it entirely.
The deprecated usage:
# `password` is a String, `iv` is either a String or nil
cipher = OpenSSL::Cipher.new("aes-256-cbc")
cipher.encrypt(password, iv)
p cipher.update("data") << cipher.final
was equivalent to:
cipher = OpenSSL::Cipher.new("aes-256-cbc")
cipher.encrypt
iv ||= "OpenSSL for Ruby rulez!"
key = ((cipher.key_len + 15) / 16).times.inject([""]) { |ary, _|
ary << OpenSSL::Digest.digest("MD5", ary.last + password + iv[0, 8].ljust(8, "\0"))
}.join
cipher.key = key[...cipher.key_len]
cipher.iv = iv[...cipher.iv_len].ljust(cipher.iv_len, "\0")
p cipher.update("data") << cipher.final
https://github.com/ruby/openssl/commit/e46d992ea1
|
|
It doesn't make sense to set ivars or anything shape
related on a T_IMEMO.
Co-Authored-By: John Hawthorn <[email protected]>
Notes:
Merged: https://github.com/ruby/ruby/pull/13347
|
|
RUBY_FL_USER3
(https://github.com/ruby/stringio/pull/133)
This way when someone removes these flags from Ruby or update them,
they'll find this reference when greping.
Followup: https://github.com/ruby/stringio/pull/128
https://github.com/ruby/stringio/commit/fad26ee14b
|
|
- `rb_thread_fd_close` is deprecated and now a no-op.
- IO operations (including close) no longer take a vm-wide lock.
Notes:
Merged-By: ioquatix <[email protected]>
|
|
Report EOF when applicable instead of an empty fragment.
Also stop fragment extraction on first whitespace.
https://github.com/ruby/json/commit/cc1daba860
Notes:
Merged: https://github.com/ruby/ruby/pull/13310
|
|
https://github.com/ruby/json/commit/f3dde3cb2f
Notes:
Merged: https://github.com/ruby/ruby/pull/13310
|
|
https://github.com/ruby/json/commit/41f1f6939d
Notes:
Merged: https://github.com/ruby/ruby/pull/13310
|
|
https://github.com/ruby/json/commit/30e35b9ba5
Notes:
Merged: https://github.com/ruby/ruby/pull/13310
|
|
https://github.com/ruby/json/commit/832b5b1a4c
Notes:
Merged: https://github.com/ruby/ruby/pull/13310
|
|
18d395e0784401585b5c14300e689de55e208647
|
|
https://github.com/ruby/stringio/commit/a27c5d5e2e
Co-authored-by: Sutou Kouhei <[email protected]>
|
|
chilled
StringIO does not warn for unchilled unfrozen string or for frozen
string, so it should not warn for chilled string.
https://github.com/ruby/stringio/commit/4ac33b8c70
|
|
https://github.com/ruby/psych/commit/b9dec9f811
|
|
In Ruby < 3.0, the superclass of StringIO was actually already `Data`,
but it doesn't have the expected shape. So, on these earlier versions it errors:
> NoMethodError: undefined method `members' for #<StringIO:0x00005641dd5f2880>
> vendor/bundle/ruby/2.6.0/gems/psych-5.2.5/lib/psych/visitors/yaml_tree.rb:170:in `visit_Data'
This test doesn't fail on 2.7, presumably because it can pull in a newer `stringio` version.
https://github.com/ruby/psych/commit/0f40f56268
|
|
https://github.com/ruby/erb/commit/9152ce8db4
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/13304
|
|
e.g.
```
JSON.dump(1746861937.7842371)
```
master:
```
"1.https://github.com/ruby/json/commit/746861937784+9"
```
This branch and older json versions:
```
https://github.com/ruby/json/commit/1746861937.7842371
```
In the end it's shorter, and according to `canada.json` benchmark
performance is the same.
https://github.com/ruby/json/commit/866f72a437
|
|
|
|
|
|
https://github.com/ruby/psych/commit/dbf9e36583
|
|
https://github.com/ruby/psych/commit/336553b412
|