Repository navigation
sp_net_connect_timeout: a connect with a deadline - #2
Closed
baron-hines wants to merge 85 commits into
Closed
baron-hines wants to merge 85 commits into
baron-hines wants to merge 85 commits into
Conversation
`return to_enum(__method__, include_self: include_self) unless block_given?` was refused: the Enumerator that calls the method again took positional arguments only, and read a parameter again only when it was a positional one. Keywords whose values it can read again (a literal, or a keyword parameter nothing writes) now go to the call as they were given.
A scan block computes its matches first and walks the subject again per turn only when the body reads $~ or a match global, and `Regexp.last_match` was not counted as one: the block read the last match on every turn. It now counts. `str.to_enum(:scan, re)` was left as a call no String answers. Under a map or an each whose block leaves by none of next, break or redo, the consumer's block now becomes scan's own block (map collecting its values), so it sees each match in $~ as CRuby's Enumerator gives it.
A boxed receiver's cover? took the Range pre-arms only while no class of the program defined cover?. With one that did (a wrapper of a Range), the dispatch had that class's arm alone, and a Range raised NoMethodError, also for a Range built from boxed ends ((lo..hi).cover?(n)). The pre-arms now stand in front of the class's arm whenever the call answers a truth value or a box. A receiver of another class, which no arm takes, raises NoMethodError as in CRuby; it answered false.
`self.class.largest ||= v` in a module several classes include, each with a class-level accessor, was refused (an unsupported call-or-write on a receiver that is no object). A Class value now takes the two calls Ruby means, as a boxed receiver already did: `recv.attr || (recv.attr = v)`, the receiver evaluated once. `self.class` is read again for the writer rather than held in a temp.
A block call without arguments on a boxed receiver, for a name a class of the program defines too (Set's map!, delete_if, select!), dispatched to that class's arm alone: the builtin default declined every such call. An Array or a Hash raised NoMethodError for map!, delete_if, select! and the other mutators it has. The default now takes the builtin's arm for the in-place mutators, which answer the receiver or nil, where the call answers a box; the other block calls keep declining, since their answer (a count, a truth value) is not of the type the arm is written for.
`seen = h.fetch(k) { h[k] = v; return false }` was refused: the block's
last statement is the fetch's value, emitted as an expression, and a
return is none. A fallback block that ends in `return` now runs it as
the statement it is; the value after it is never read.
…s own
A block call as a statement on a boxed receiver (`kids.delete_if { }`),
for a name a class of the program defines too (Set's delete_if),
dispatches on the class and re-enters the statement's builtin emission
for its default. That arm was dropped whenever its text named the
NoMethodError for the method, which is how a declining emitter reads.
But the builtin emission of a boxed receiver ends its kind tests the
same way (`if (an Array) ... else if (a Hash) ... else raise`), so an
Array or a Hash raised NoMethodError for delete_if, keep_if, select! and
the like. Only a raise that is not the last branch of such a chain now
drops the arm.
`k = self.class; k.label` dispatches on the class id, with an arm per class that has a class method of the name. A class whose `label` was a `class << self` accessor had no arm when another class defined `label` by hand, and raised NoMethodError; the accessors had arms only when no class had such a method. They now take their arms beside the methods', and the reader is typed boxed as the accessor alone already was.
The escape was refused with RegexpError. It is CRuby's (?>\r\n|[\n\v\f\r\u0085 ]), and (?>\r\n|[\n\v\f\r]) for a byte-indexed pattern, so the compiler reads that spelling in its place: the parse cursor moves onto it and back, and the quantifiers after the escape bind the group. A CR LF pair matches as one, and a later failure does not split it. In a look-behind it raises "invalid pattern in look-behind", as CRuby's does; inside a character class it stays the letter.
poly_block_dispatch_cands stopped collecting candidate classes at the switch's capacity (64) and returned the first 64, so an instance of a class past them reached the default arm and raised NoMethodError for a method it inherits. With more candidates than the switch takes, the call now goes to the ordinary poly dispatch, which serves every class.
…has a scan
The consumer's block becomes the block of scan itself, which a boxed
receiver dispatches as any scan call: on a String, or on a program
class's own scan. The rewrite stepped aside when any class defined scan,
so `text.to_enum(:scan, re).map { }` on a boxed String raised
NoMethodError (to_enum) in such a program.
The builtin arm a boxed receiver's map! takes beside a class's own runs under the reading that its receiver is no object of the program's, and the block's body was emitted under it too: `map!(&:pos)` over Tokens called IO#pos on each, raising NoMethodError, and where its Integer answer went into the boxed element the C did not build. The step helpers that emit a builtin iterator's block (emit_iter_step_open and the rest) now drop that reading for the body.
…bute's or a writer's slot `o.x, o.y = ONE` with `ONE = [6]` and `attr_accessor :x, :y` left `o.y` at 0, where CRuby leaves nil. The same went for a local Array, a splat, a method's Array, a post-splat target (`o.x, *r, o.y = ONE`), and a `def x=` writer, a Hash key or a user `[]=` fed from a constant Array shorter than the targets. The attribute's ivar already carried its nil byte (analyze.c marks it for a multiple assignment from an Array of unknown or short length), but a call or index target read its element with sp_*Array_get and wrapped it as a value that is never nil (sp_oint_of), so the byte was set to "not nil" and the read past the end gave 0. The typed Array arm of emit_multi_write_scalar now reads such an element through masgn_elem_temp, the oint temp the literal arm already uses (sp_*Array_oget, nil past the end), which masgn_conv_o and a boxed slot (masgn_conv) take with its nil. A user writer, a Hash value or an index writer that has no nil slot of its own learns about the nil from the element read back as type evidence (desugar_masgn_store_evidence): elem_miss_call counted that read as no miss, so the writer's parameter stayed an Integer. elem_miss_call now counts it a miss past the end of a constant Array of a known length. For a target after the splat the desugar records the number of lefts and of rights, and the j-th right is a miss when lefts + j >= len (the element it takes is at the larger of len - rights + j and lefts + j). masgn_target_takes_nil keeps the oint temp to targets whose slot holds a nil or is boxed, so a program with only plain Integer slots keeps its C. masgn_conv_param puts the oint into a writer parameter that holds its nil, a plain value included. A writer that keeps its value in a Hash of boxed values (`@h[k] = v` over a Float or Integer parameter that holds a nil) unwrapped it with sp_ofloat_arg or sp_oint_arg, which raised a TypeError for the nil, also without a multiple assignment; the expression form of the Hash store now holds such a value as its oint and boxes it with its nil. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Where the program reopens Module and some class defines its own is_a?, a boxed value's is_a?(Module) took Module for a class of the program's and asked for a program object under it, which a class value never is: activesupport's lazy load hooks ran instance_eval on ActionDispatch::Request. A name of a builtin class now takes the builtin's kind check, as a reopened Array already did. And a boxed class value carries its class's index as cls_id, so the dispatch's unguarded switch took it into that class's instance arm (the class value of a class with its own is_a? answered as an instance of it). Where the program holds a class as a value, the key is guarded on the object tag as it is when class 0 is a candidate. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VXZndU8ST2PpoRWZ4iiejs
…a reopened Module Co-Authored-By: Claude <noreply@anthropic.com>
baron-hines
force-pushed
the
sp-net-connect-timeout
branch
from
October 19, 2026 04:21
bbad867 to
78c75ab
Compare
Strings are shared by reference in the one mode (44119ab), and --share-strings is accepted and ignored, so the refusals that began with "under --share-strings," named a flag that means nothing. The lead comes off the seven messages (the seal's two, the route and holder messages in repr.c, and the attribute interpolation one), the expectations follow, and the collect-errors test and the new-String oracle recognise a seal refusal by its wording. Refs matz#9258 Co-Authored-By: Claude <noreply@anthropic.com>
emit_case_eq_call compares a scalar-comparable receiver against a boxed
argument by value equality, and a String range (equality family 7) was
among them: ("a".."z") === x with a boxed "abc" asked Range == String,
so grep("a".."z") over a mixed Array answered [].
A String range now emits sp_poly_case_eq, the runtime coverage rule,
which also reads a shared mutable String. The same comparison serves
every === of a String range against a boxed value, so count, select,
filter_map and an explicit r === x are fixed with it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gate: green tree de5c80426585 master c15c84f (darwin-arm64 clang-21.0.0) tests 8104/0
sp_powmod multiplied two residues below the modulus in sp_int before taking the remainder; once the product passed 2^63 (a modulus above 3037000499) it overflowed, undefined behaviour in C: 2.pow(63, 5843009213693953) answered -3103497645717974, where CRuby answers 3103497645717974. sp_powmod_mul keeps that multiply below 3037000500, where the product fits, and otherwise forms the full product in unsigned 128-bit arithmetic where SP_HAVE_INT128 is set, or by doubling and adding unsigned residues, reducing each sum, which stays below twice the modulus. The boxed routes share sp_powmod and are fixed with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Gate: green tree 2cd330e1c4b9 master 5144f36 (darwin-arm64 clang-21.0.0) tests 8104/0
nil.methods, 1.methods, "s".public_methods and the like raised NoMethodError: only an instance of the program's own class listed its methods. A typed nil, true or false, Integer, Float, Symbol, String, Array, Hash, Range, Regexp, Rational, Proc or Time now answers the names CRuby lists for its class, read from core_class_methods.inc through the class's ancestors, with what the program's reopenings of the class and its ancestors add. A receiver that may hold nil picks NilClass's list at run time. A boxed receiver (an Object.new, a value widened under --int-overflow=promote) picks the list by its tag or class at run time, an instance of the program's own class taking its class's list; a BasicObject raises NoMethodError and a builtin class the table cannot list in full (Complex undefines inherited methods) raises NotImplementedError. The lists are written once, as two helpers the finished program calls (as pd_emit_used writes its own): sp_value_methods(k) holds one static table per list a call names, and sp_value_methods_poly(v, prot) picks the list of a boxed value's class. A call only calls them.
## Background `type patch_t = Array[untyped]` beside `def apply: (Array[patch_t]) -> ...` left `apply` with no seed for that parameter: a reference to an alias was out of the subset, so the field was dropped, and a parameter no call site binds then read as untyped. ## Fix The extractor now collects every `type` declaration, at the top level or in a class or module, before it reads a signature: a pass over the files after the names pass, repeated while a round registers an alias whose type names one declared later or in another file. A reference maps as the aliased type does, and its name resolves as a class name does: the declaration's own namespace, the enclosing ones innermost outward, then the top level. A generic alias (`type listed[T]`) stays out of the subset. The inline RBS reader registers no alias, so an annotation that names one is not applied, as before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WA5cW6UWZ6UVReAknDAnxj
The Array fetch's fallback reads its block's value through emit_blk_value_as (and its oint form), which took a final `return` for the value and refused it as an expression. A block that ends in return now runs it as the statement it is, as the Hash fallback's does.
…handle A call whose receiver may be nil runs its arguments ahead of the test (emit_nil_target_head_r). An argument that is a shared String's handle (a slot's, a reader's) was held as its value form, a copy of its bytes, and the arm that boxes the handle for a boxed parameter then boxed that copy as one, sp_box_nullable_obj of a const char *: clang refused the C, and gcc's binary read the key's first bytes as a data pointer and died (matz#9602). The head holds such an argument as the handle, and its reads take the handle's String (ran_first_bind_read), as the operand-order rewrite holds one. Refs matz#9602 Co-Authored-By: Claude <noreply@anthropic.com>
refuse_set_identity_members refuses a boxed Set member once the program may call Set#compare_by_identity, and counted any compare_by_identity on a boxed receiver. A computed name (`o.method(name)`, `o.send(name)`) is dispatched over every name the program defines, so a class's own compare_by_identity (Rack::Headers') put one such call in the program, and every Set taking a boxed member was refused (a Rails program's builtins/object_space.rb among them). A send's or method()'s arm and a method(name) wrapper no longer count, unless the program spells the name. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VXZndU8ST2PpoRWZ4iiejs
A `self.class` receiver was read again for the writer instead of held in the temp, which runs a program's own `class` method twice where CRuby runs it once. It is held in the temp as any other receiver is.
…method In the dispatch of a call on a Class value held in a variable, a class that only inherits `def self.label` from its superclass but declares `class << self; attr_accessor :label; end` itself took the inherited method's arm, and its accessor arm was skipped because the chain had a class method. CRuby looks in the class's own singleton class first, so the accessor wins; only a class method the class defines itself comes ahead of it. The method arms now skip such a class, and the accessor arm is taken for it, including a class below it that reads its own slot.
The dispatch key an Array subclass brought (matz#7449) held the receiver's subclass in a variable of its own, _ak<N>. pd_hoist moves a switch out of line only when every `_` name in it is a temp it can renumber, so from then on a program with one Array subclass anywhere wrote every boxed dispatch inline at each site: campfire's C had no sp_pd_ function left, and its switches were 40% of 42.8 MB. The key is now a temp (_t<N>), renumbered with the rest: campfire's C is 26.6 MB, with 1,130 shared dispatch functions. Co-Authored-By: Claude <noreply@anthropic.com>
The class-fact walk takes a builtin call's answer from the share rows of the four families (Object, String, Array, Hash). Those have no Enumerator family, and next is String's and Integer's successor there, PURE: the value of `greeters.each.next` was taken as a builtin value, the dispatch on it had no arm for the program's class and raised NoMethodError (a regression of 4299fea, which first took the rows' answer). bop_share_kinds adds BSH_ELEM for next and peek, and BSH_SUB for next_values and peek_values, beside the four families' answers, the way it already adjusts Hash's keys and key. Refs matz#9620 Co-Authored-By: Claude <noreply@anthropic.com>
…ir own Co-Authored-By: Claude <noreply@anthropic.com>
Complex(true) and Complex(false) raise TypeError, but with exception: the flag was not read: a Boolean literal converted to 0 or 1 whatever the flag, and a boxed Boolean raised TypeError under exception: false. emit_nullable_numeric_convert already answers Complex(x, exception: flag) for a nil or boxed x: it validates the flag and answers nil for a nil x when the flag is false. It now takes a Boolean x for Complex the same way, raising sp_complex_reject_bool's TypeError when the flag is true, and a boxed value holding a Boolean takes that branch at run time. Inference types Complex(bool, exception: ...) poly so the call can answer nil. Rational's Boolean keeps its own path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Gate: green tree 9032ecf master 42304a3 (darwin-arm64 clang-21.0.0) tests 8119/0
Enumerable#min_by and #max_by in builtins/enumerable.rb compared the count with zero before converting it, so a String count raised ArgumentError from the comparison where CRuby raises TypeError, and a count object with its own to_int was refused at compile time. They now convert the count first through __enum_count_int, which emits sp_poly_arg_int_chk, the strict conversion native count arguments use, with the boxed argument rooted while to_int runs. The call is typed Integer and listed among the receiverless builtins so desugaring does not take it for an Array method. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Gate: green tree b21e10eb4174 master e9d5800 (darwin-arm64 clang-21.0.0) tests 8121/0
Through an IO whose class is only known at run time (an Array element beside a nil), `write(bytes)` and `&.write(bytes)` chose the entry by the operand's static type, so an operand that was itself boxed took the plain sp_File_write and stopped at its first NUL. They now take sp_File_write_poly, as the TY_IO arm does, which picks by the tag. `<<` on such an IO (sp_poly_shl) tested the tag but not for a shared String's handle, which is how a mutable String is boxed now, so it took the plain entry too; it reads the handle's bytes first. Test: test/boxed_io_write_poly_nul.rb. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019xBfKKpKfj9CtrZK5zVjhE Gate: green tree 2afd9d7 master e9d5800 (linux-x86_64 gcc-14.2.0) tests 8122/0
Co-Authored-By: Claude <noreply@anthropic.com>
A mutable String reaches `%` as a shared handle when it goes through a poly value (an element of a mixed Array, an argument the analysis could not type), and the conversions read only the plain String tag: `%c` printed nothing for it, and `%d` and `%f` refused it as no String, where CRuby prints the first character and converts the digits. `%s` was right, since sp_poly_to_s reads a handle. The formatter now reads the handle as its value once, where it takes each argument, so every conversion sees the String. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WA5cW6UWZ6UVReAknDAnxj Gate: green tree dc83e2d master e9d5800 (linux-x86_64 gcc-13.3.0) tests 8122/0
Strings are shared by reference since 44119ab, so a message that explained a refusal by the copy ("a String is copied, not shared", "waits on matz#6765", "--share-strings supports it") no longer said why. The String instance variable refusal says a String keeps no instance variables yet; the runtime's instance_variable_set raise and String#encode! drop the copy; the route refusals that still stand point to matz#9258, where the remaining share defects are kept; docs/limitations.md says the same of the String instance variable. Refs matz#9258 Co-Authored-By: Claude <noreply@anthropic.com>
A subclass of StringIO that hands its argument on through super, in initialize to the class's constructor or in string= to StringIO#string=, answered a copy: the share walk took a super into a native class's binding as a call it does not follow, so the parameter was a byte-only slot and the codegen called the copying forms (sp_StringIO_init_s, sp_StringIO_set_string). A write through the instance then stayed out of the String the caller held, and #string answered another String (matz#9258, "passing a shared String through super"). The instance a method of such a subclass runs on holds the String the object keeps (its self holder, sh_native_keeps_self, as a String reopening's self holds its String), the value of the subclass's new is that instance, and a super into the binding keeps or answers through it as sh_native_new and sh_native_call do for a call on the object. The codegen takes the binding's handle form on self (sp_StringIO_init_h, sp_StringIO_set_string_h) where the instance's String is shared, and a string= whose tail is that super publishes the handle it kept, as a builtin tail does. The String-self representation (repr_self_handle, the SHK_SELF holder's slot) stays a String reopening's: a native subclass's self is the object. Refs matz#9258 Co-Authored-By: Claude <noreply@anthropic.com>
…with its length Co-Authored-By: Claude <noreply@anthropic.com>
…ch functions again Co-Authored-By: Claude <noreply@anthropic.com>
…anded to % as its value Co-Authored-By: Claude <noreply@anthropic.com>
A get_value whose type symbol is a literal lowered to sp_IOBuffer_get_i or _get_f, out of line in the runtime archive, so every read paid a call, a type-table lookup, the slice and bounds checks and a generic byte loop. The generated program now includes lib/sp_iobuffer.h when it uses IO::Buffer, and the fold calls sp_IOBuffer_load_i / _load_f there: with the type a constant, the width, byte order and sign fold away and a read is one bounds check and one load. Every integer type up to 32 bits and the four float types take it; the 64-bit integers keep sp_IOBuffer_get_x, since they read boxed. Same answers and errors: an owned buffer and an in-range offset load directly, and everything else (a slice, a freed, transferred or shrunk root, a negative, edge or wrapping offset) calls the out-of-line read, which raises as before. The compiler's own externs agree with the header's prototypes, so including it adds no second definition. A slice's data is always NULL, so the data test sends every slice to the out-of-line read without a test of its own. 150 M reads through an attr_reader, darwin-arm64, scan only, medians of 11 interleaved runs: U8 227 -> 75 ms (8.55G -> 2.25G instructions), u32 363 -> 80 ms (13.50G -> 2.70G), F64 534 -> 190 ms (11.10G -> 5.40G). A 300 M U8 scan now costs what String#getbyte's does (144 ms and 4.50G against 156 ms and 4.50G). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Gate: green tree 9a928d0 master 2a357df (darwin-arm64 clang-21.0.0) tests 8123/0
… settle A parameter no typed call binds (a Thread block's, which Thread.new's arguments do not type) is widened to poly after the main fixpoint, and the parameters it reaches are bound again. That re-bind ran before the locals and returns derived from the widened parameter were re-derived, so it still saw what the main fixpoint left. A method answering the parameter on one class and another class's object on a subclass had answered that object alone, and a parameter the answer reached stayed typed as that object: an IO passed through it was a TypeError at the call. The re-bind now alternates with the write and return re-runs. Test: test/widened_param_rebinds_callees.rb. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019xBfKKpKfj9CtrZK5zVjhE Gate: green tree 3f049ac master cfc1257 (linux-x86_64 gcc-14.2.0) tests 8125/0
Integer(Rational(3, 2), exception: false) and Float(Rational(3, 2), exception: false) answered nil, where CRuby answers 1 and 1.5, as the strict forms already do here. The lenient arms of the Kernel#Integer and Kernel#Float emitters admit an argument typed Rational, and the runtime's lenient paths (sp_kernel_Integer_val, sp_poly_Float_ex) convert a Rational, typed or boxed: Integer truncates through sp_poly_to_i_meth_v, holding the value rooted while it allocates, and Float divides. The Integer result keeps its Integer slot, so a quotient past 64 bits is nil there, as a Bignum is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Gate: green tree 7b739fa master 131a2a1 (darwin-arm64 clang-21.0.0) tests 8126/0
… poly form An ivar an --rbs seed pins to Array[String]? whose Strings another name shares settles in its poly form, the boxes holding the handles (the share rule, since 44119ab). A class method declared `-> Array[String]?` that answers such Strings kept its String Array return, so its value was read out as bytes at the return and wrapped into fresh handles at the store: the seed check refused the write as a contradiction ("@to is declared Array[untyped] but this assigns Array[String]", matz#9626), and without the check the stored Strings would have been copies. The return of such a method settles in its poly form too, as a seeded local does (Scope.ret_elems_shared), with its sources demanded as handles; the seed checks take a String Array written into a slot or answered from a return that settled so as the same Ruby type in its shared C form, not a contradiction. Refs matz#9626 Co-Authored-By: Claude <noreply@anthropic.com>
…eads inline Co-Authored-By: Claude <noreply@anthropic.com>
…d by its face `def w(v) = yield(v).reverse!`, called with an Integer Array block at one site and a String Array block at another, never finished compiling, and neither did `compact!` or `select!`. `sort!`, `rotate!`, `uniq!` and `shuffle!` on such a yield finished, but gave a C compile error (`assigning to 'sp_RbVal' from incompatible type 'sp_PolyArray *'`). A yield beside a second site that gives another kind of value is boxed, and a call on it is taken per kind the box holds: emit_face_arm unboxes the receiver, retypes it to the face's kind with a type view and a face pin, and re-enters the same call, so the typed emitter writes the answer. sp_yield_site_type, which comp_ntype asks first for a yield, answered the block's tail (poly here) over that view, so the re-entered call saw its receiver as boxed again and took the face again, one level deeper each time. A name with a single owner (`sort!`, `rotate!`, `uniq!`, `shuffle!`) gave up at some depth and left C that mixed the boxed receiver with the typed answer; a name with several owners (`reverse!` has String and Array, `compact!` and `select!` Array and Hash) began a chain per owner at every level, so the compile did not end. sp_yield_site_type now leaves a yield that is pinned to a face to the node's cached type, which is the view, so the re-entry is the typed emitter's call on the face's kind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`@x = v` in a method a program adds to String, and instance_variable_set on a String, were refused: a String was copied between its representations, so it had no one identity for the variable to live on. Strings are shared by reference now (44119ab), and a shared String's handle is the one identity it has. String joins the classes whose instance variables the runtime keeps in its table keyed by the object (Array, Hash, Random): a method added to String reads and writes them through the table, as an Array's does, and the reflection on a String reaches the same table; the table's key is the String's handle. The share walk gives a String an instance variable is kept on that identity, in every name that holds it (SHE_IVARS, the class's SHF_IDENTITY), so the String reaches the table as its handle rather than as bytes. dup and clone copy the variables, as CRuby's do: where the program keeps any, a String's dup or clone is made as a new handle that takes the copy (sp_String_dup_h). A frozen String raises FrozenError on a write, and a String the program holds as bytes alone still raises NotImplementedError at run time, as before. The two refused programs are tests now, with CRuby's answers, beside test/string_ivar_methods.rb. Refs matz#9258 Co-Authored-By: Claude <noreply@anthropic.com>
…aves nil in an attribute's or a writer's slot Co-Authored-By: Claude <noreply@anthropic.com>
…er call site is typed by its face Co-Authored-By: Claude <noreply@anthropic.com>
… its callers' locals settle Co-Authored-By: Claude <noreply@anthropic.com>
… one mode Strings are shared by reference since 44119ab, and --share-strings is accepted and ignored, so every branch the copying build alone took was dead: the refusals of a String stored through a conversion or an identity method (sa_refuse_stored_call, the stored-call sweep), of a Struct member or a multiple-assignment target holding a String another name holds, of a mutator entry on a boxed String, and of self handed to a block; the copying forms of a computed instance variable write, a freeze chain's read, a read buffer's slot, a pickup's wrapped return, an interpolation's part spans and nil.inspect; and the tests of the flag in front of the share rule's own passes. The generated C of the corpus is unchanged (cident 0 differ, 0 refusal changes against d11c233). The guards that only return early without the rule (`if (!repr_share_rule(c)) return 0`) stay for a later sweep: they take nothing with them. Refs matz#6765 Co-Authored-By: Claude <noreply@anthropic.com>
…ped, not reinterpreted The check the pull request adds is master's since a147d7c (matz#9626), which also settles the seeded return in its poly form; this commit carries its test, whose receivers the analysis cannot see (a `send` to a define_singleton_method) and a program class's own `map` and `fetch` lead the share rule to box the slot. Refs matz#9626
sp_net_connect waits as long as the kernel does, which for an address that never answers is over a minute. sp_net_connect_timeout(host, port, timeout_s) gives up after timeout_s seconds across every address the host resolves to, parking the green thread with the deadline under SP_THREADS (sp_net_wait_io_until, as sp_net_recv_some_timeout does). sp_net_take_connect_timeout() tells a timeout apart from a refusal or a failed lookup, both of which also answer -1; reading it clears it. The connect is non-blocking in every build so the deadline holds; the unthreaded build puts blocking back on the fd it returns, so callers get the same kind of fd sp_net_connect gives them. A negative timeout_s is sp_net_connect. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
baron-hines
force-pushed
the
sp-net-connect-timeout
branch
from
October 19, 2026 11:14
78c75ab to
59c06d9
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this changes
Before:
sp_net_connectwaits as long as the kernel does. When nothing answers at that address (a host that is down, or a firewall that drops packets), that is over a minute, and a caller can't shorten it.After:
sp_net_connect_timeout(host, port, timeout_s)gives up aftertimeout_sseconds and returns -1.sp_net_take_connect_timeout()tells a timeout apart from a refusal or a failed lookup, since those also return -1. Reading it clears it, likesp_net_take_recv_timeout.How:
timeout_sissp_net_connect.sp_net_wait_io_until, whichsp_net_recv_some_timeoutadded in sp_net: add sp_net_recv_some_timeout, a read with a deadline matz/spinel#9584. UnderSP_THREADSthe green thread parks with the remaining time. The unthreaded build polls in 1 s slices, so the term flag still ends the wait.sp_net_connectgives them.sp_net_connectand the other existing calls are unchanged.Tests (both
# spinel: not-cruby, since they useffi_func):test/sp_net_connect_timeout.rbuses a listener that never accepts. Once its accept queue is full, the kernel drops new SYNs, so a connect hangs as it would to a dead host. The test checks that a listener with room connects without a timeout, that a negative timeout connects, that a full queue times out after the deadline, that a refused port is -1 but not a timeout, and that a name that doesn't resolve is not a timeout either.test/sp_net_connect_timeout_threads.rb: a green thread parks in a timed connect to the full queue, the main thread keeps running, and the connect ends at its deadline.sp_net_*and TCP socket tests (11 of 11).Why
This is for Roundhouse's Sidekiq support (rubys/roundhouse#1047), and it follows matz#9584, which added the read deadline. A Rails app compiled by Roundhouse pushes
perform_laterjobs to Redis from inside web requests, through spinel-redis. If the Redis address stops answering, the connect holds the request for over a minute. A real Sidekiq client gives up after redis-rb'sconnect_timeoutand raises. spinel-redis'sconnect_timeout:uses this call.🤖 Generated with Claude Code