[pull] master from ruby:master - #1393
Merged
Merged
Conversation
A message sent to a Ractor::Port is enqueued on the receiving Ractor's
recv_queue, and only moved to that port's own queue when the Ractor
receives or closes. rb_ractor_reap_dead_ports() sweeps the port queues
held in sync.ports, so a message whose port became unreachable before any
delivery happened was never reaped: it stayed on recv_queue, off-heap and
invisible to ObjectSpace, for the life of the process.
200.times { p = Ractor::Port.new; 1000.times { p << ("z" * 4000) } }
grew without bound (RSS 858 -> 1692 -> 2523 MB over three such passes),
and needs no Ractor at all to hit. Closing the port, or any receive on
the same Ractor, moved the messages to the port queue and hid the leak.
Sweep recv_queue in the reap as well, dropping the baskets whose port is
no longer in the table. The reap takes no sync lock: what keeps out the
foreign senders that write recv_queue is the caller's gate in
rb_ractor_finish_marking(), where a global GC has the world stopped and a
single objspace has exactly one live Ractor. Assert that at the callee,
so a second caller cannot lose the guarantee silently.
[Bug #22122]
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ey are given The pure-Ruby generator's private _configure gives every keyword a literal default, so a call that passes one option silently resets the other fifteen. The method is also aliased as merge, so a state built with indent/object_nl starts emitting compact JSON after any later configure call. The C extension does not behave this way. configure_state_i walks only the keys actually present in the hash, so State#merge really merges there. Default the keywords to the current ivars so the pure generator agrees. initialize already assigns every ivar to its literal default before calling _configure(**opts), so construction is unchanged. ruby/json@46fbe24b04
It's not a bug to be out of memory. Though, the code did have a separate bug: perror() can fail to write to stderr and set `errno` which made the check that followed it questionable. When perror() succeeds it could clobber `errno` anyways, because the spec allows it. Just abort.
`rb_concurrent_set_foreach_with_replace` is not safe to run in the case of other running mutators or GCs.
The IPv4 branch matches 224.0.0.0/24, the Local Network Control Block, but the IPv4-mapped branch masked with 0xffff0000, which is a /16, even though its comment says /24. So an address was classified differently depending on whether it arrived as 224.0.1.1 or ::ffff:224.0.1.1, which is the form a dual-stack AF_INET6 socket hands you. The other predicates in the family already use the same mask on both branches. ruby/ipaddr@eebe5b237d
GC.measure_total_time= writes the flag of the calling Ractor's objspace, and every new objspace started with the flag on, so turning the timing off never reached the Ractors created afterwards: each of them kept paying two clock reads per GC phase, and GC.stat :time in a Ractor did not follow the setting. Start a Ractor's objspace with its creator's current value, the way ractor_create already carries over verbose and debug. The creating Ractor's thread is the one running this init, so the value is read without touching another Ractor's objspace. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )