summaryrefslogtreecommitdiff
path: root/ext
AgeCommit message (Collapse)Author
2023-12-15stop warnings from running the test case requiring .so twiceSatoshi Tagomori
2023-12-14rb_ext_resolve_symbol: C API to resolve and return externed symbols [Feature ↵Satoshi Tagomori
#20005] This is a C API for extensions to resolve and get function symbols of other extensions. Extensions can check the expected symbol is correctly loaded and accessible, and use it if it is available. Otherwise, extensions can raise their own error to guide users to setup their environments correctly and what's missing.
2023-12-13[ruby/io-console] Bump up 0.7.0Hiroshi SHIBATA
https://github.com/ruby/io-console/commit/3e5586e632
2023-12-13[ruby/io-nonblock] Bump up 0.3.0Hiroshi SHIBATA
https://github.com/ruby/io-nonblock/commit/501e2ffea3
2023-12-13[ruby/io-wait] Bump up 0.3.1Hiroshi SHIBATA
https://github.com/ruby/io-wait/commit/5ec3db36c8
2023-12-13[ruby/etc] Bump up 1.4.3Hiroshi SHIBATA
https://github.com/ruby/etc/commit/743c26086d
2023-12-13Add a test case for preregistering with different dataKJ Tsanaktsidis
We want to make sure that if preregister is called with different data, that the postponed job table is updated.
2023-12-13Simplify implementation of tracepoint testsKJ Tsanaktsidis
With the latest version of the postponed job patchset merged, we don't actually need to go through the contortions of keeping the data in a global variable; we can just update `data` with multiple calls to rb_postponed_job_preregister.
2023-12-12Partially revert "Set AI_ADDRCONFIG when making getaddrinfo(3) calls"KJ Tsanaktsidis
This _partially_ reverts commit d2ba8ea54a4089959afdeecdd963e3c4ff391748, but for UDP sockets only. With TCP sockets (and other things which use `rsock_init_inetsock`), the order of operations is to call `getaddrinfo(3)` with AF_UNSPEC, look at the returned addresses, pick one, and then call `socket(2)` with the family for that address (i.e. AF_INET or AF_INET6). With UDP sockets, however, this is reversed; `UDPSocket.new` takes an address family as an argument, and then calls `socket(2)` with that family. A subsequent call to UDPSocket#connect will then call `getaddrinfo(3)` with that family. The problem here is that... * If you are in a networking situation that _only_ has loopback addrs, * And you want to look up a name like "localhost" (or NULL) * And you pass AF_INET or AF_INET6 as the ai_family argument to getaddrinfo(3), * And you pass AI_ADDRCONFIG to the hints argument as well, then glibc on Linux will not return an address. This is because AI_ADDRCONFIG is supposed to return addresses for families we actually have an address for and could conceivably connect to, but also is documented to explicitly ignore localhost in that situation. It honestly doesn't make a ton of sense to pass AI_ADDRCONFIG if you're explicitly passing the address family anyway, because you're not looking for "an address for this name we can connect to"; you're looking for "an IPv(4|6) address for this name". And the original glibc bug that d2ba8ea5 was supposed to work around was related to parallel issuance of A and AAAA queries, which of course won't happen if an address family is explicitly specified. So, we fix this by not passing AI_ADDRCONFIG for calls to `rsock_addrinfo` that we also pass an explicit family to (i.e. for UDPsocket). [Bug #20048]
2023-12-10add `flags` to `rb_postponed_job_preregister`Koichi Sasada
for future extensions.
2023-12-10Change the semantics of rb_postponed_job_registerKJ Tsanaktsidis
Our current implementation of rb_postponed_job_register suffers from some safety issues that can lead to interpreter crashes (see bug #1991). Essentially, the issue is that jobs can be called with the wrong arguments. We made two attempts to fix this whilst keeping the promised semantics, but: * The first one involved masking/unmasking when flushing jobs, which was believed to be too expensive * The second one involved a lock-free, multi-producer, single-consumer ringbuffer, which was too complex The critical insight behind this third solution is that essentially the only user of these APIs are a) internal, or b) profiling gems. For a), none of the usages actually require variable data; they will work just fine with the preregistration interface. For b), generally profiling gems only call a single callback with a single piece of data (which is actually usually just zero) for the life of the program. The ringbuffer is complex because it needs to support multi-word inserts of job & data (which can't be atomic); but nobody actually even needs that functionality, really. So, this comit: * Introduces a pre-registration API for jobs, with a GVL-requiring rb_postponed_job_prereigster, which returns a handle which can be used with an async-signal-safe rb_postponed_job_trigger. * Deprecates rb_postponed_job_register (and re-implements it on top of the preregister function for compatability) * Moves all the internal usages of postponed job register pre-registration
2023-12-07[ruby/io-console] [DOC] Add documentation for IO#cursorMatheus Richard
ruby/io-console#50 https://github.com/ruby/io-console/commit/ee752ce771
2023-12-07Set AI_ADDRCONFIG when making getaddrinfo(3) calls for outgoing conns (#7295)KJ Tsanaktsidis
When making an outgoing TCP or UDP connection, set AI_ADDRCONFIG in the hints we send to getaddrinfo(3) (if supported). This will prompt the resolver to _NOT_ issue A or AAAA queries if the system does not actually have an IPv4 or IPv6 address (respectively). This makes outgoing connections marginally more efficient on non-dual-stack systems, since we don't have to try connecting to an address which can't possibly work. More importantly, however, this works around a race condition present in some older versions of glibc on aarch64 where it could accidently send the two outgoing DNS queries with the same DNS txnid, and get confused when receiving the responses. This manifests as outgoing connections sometimes taking 5 seconds (the DNS timeout before retry) to be made. Fixes #19144
2023-12-06[ruby/bigdecimal] Clarify that JSON methods come from the JSON gemPeter Zhu
https://github.com/ruby/bigdecimal/commit/581725d4e5
2023-12-06[ruby/bigdecimal] [DOC] Add section Methods for Working with JSONBurdetteLamar
https://github.com/ruby/bigdecimal/commit/2edd8d0a23
2023-12-05[flori/json] Bump up 2.7.1Hiroshi SHIBATA
https://github.com/flori/json/commit/a1af7a308c
2023-12-05Removed obsoleted version definitionHiroshi SHIBATA
2023-12-05[flori/json] Detect json version from version.rbHiroshi SHIBATA
https://github.com/flori/json/commit/3ef57b5b39
2023-12-05[flori/json] The modern Ruby uses utf-8 encodings by defaultHiroshi SHIBATA
https://github.com/flori/json/commit/11b31210ac
2023-12-05[flori/json] [DOC] RDoc for additionsBurdette Lamar
(https://github.com/flori/json/pull/557) * RDoc for additions * Update lib/json/add/time.rb Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org> --------- https://github.com/flori/json/commit/3f2efd60f7 Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
2023-12-05[flori/json] Fix JSON.dump overload combinationtompng
https://github.com/flori/json/commit/41c2712a3b
2023-12-05[flori/json] Overload kwargs in JSON.dumpTakashi Kokubun
https://github.com/flori/json/commit/936f280f9f
2023-12-05[flori/json] JSON.dump: handle unenclosed hashes regressionJean Boussier
Fix: https://github.com/flori/json/issues/553 We can never add keyword arguments to `dump` otherwise existing code using unenclosed hash will break. https://github.com/flori/json/commit/8e0076a3f2
2023-12-01Manually merged from flori/jsonHiroshi SHIBATA
> https://github.com/flori/json/pull/525 > Rename escape_slash in script_safe and also escape E+2028 and E+2029 Co-authored-by: Jean Boussier <jean.boussier@gmail.com> > https://github.com/flori/json/pull/454 > Remove unnecessary initialization of create_id in JSON.parse() Co-authored-by: Watson <watson1978@gmail.com>
2023-12-01Rename escape_slash in script_safe and also escape E+2028 and E+2029Jean Boussier
It is rather common to directly interpolate JSON string inside <script> tags in HTML as to provide configuration or parameters to a script. However this may lead to XSS vulnerabilities, to prevent that 3 characters need to be escaped: - `/` (forward slash) - `U+2028` (LINE SEPARATOR) - `U+2029` (PARAGRAPH SEPARATOR) The forward slash need to be escaped to prevent closing the script tag early, and the other two are valid JSON but invalid Javascript and can be used to break JS parsing. Given that the intent of escaping forward slash is the same than escaping U+2028 and U+2029, I chos to rename and repurpose the existing `escape_slash` option.
2023-12-01Use ruby_xfree to free buffersJean Boussier
They are allocated with ruby_xmalloc, they should be freed with ruby_xfree.
2023-12-01[flori/json] Bump up 2.7.0Hiroshi SHIBATA
https://github.com/flori/json/commit/ca546128f2
2023-12-01[flori/json] Fix "unexpected token" offset for InfinityJohn Hawthorn
Previously in the JSON::Ext parser, when we encountered an "Infinity" token (and weren't allowing NaN/Infinity) we would try to display the "unexpected token" at the character before. https://github.com/flori/json/commit/42ac170712
2023-11-30[ruby/cgi] Fix unescapeHTMLflosacca
https://github.com/ruby/cgi/commit/67610e6ca8
2023-11-30Adjust indent [ci skip]Nobuyoshi Nakada
2023-11-30Rename rsock_raise_socket_error to rsock_raise_resolution_errorMisaki Shioi
Again, rsock_raise_socket_error is called only when getaddrinfo and getaddrname fail
2023-11-30Replace SocketError with Socket::ResolutionError in rsock_raise_socket_errorMisaki Shioi
rsock_raise_socket_error is called only when getaddrinfo and getaddrname fail
2023-11-30Add Socket::ResolutionError & Socket::ResolutionError#error_codeMisaki Shioi
Socket::ResolutionError#error_code returns Socket::EAI_XXX
2023-11-28Further fix the GVL instrumentation APIJean Boussier
Followup: https://github.com/ruby/ruby/pull/9029 [Bug #20019] Some events still weren't triggered from the right place. The test suite was also improved a bit more.
2023-11-28Retry pthread_create a few timesYusuke Endoh
According to https://bugs.openjdk.org/browse/JDK-8268605, pthread_create may fail spuriously. This change implements a simple retry as a modest measure, which is also used by JDK.
2023-11-28[ruby/stringio] Development of 3.1.1 started.Sutou Kouhei
https://github.com/ruby/stringio/commit/75da93d48f
2023-11-27Refactor and fix the GVL instrumentation APIJean Boussier
This entirely changes how it is tested. Rather than to use counters we now record the timeline of events with associated threads which makes it much easier to assert that certains events are only preceded by a specific event, and makes it much easier to debug unexpected timelines. Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com> Co-Authored-By: JP Camara <jp@jpcamara.com> Co-Authored-By: John Hawthorn <john@hawthorn.email>
2023-11-27[ruby/stringio] Do not compile the C extension on TruffleRubyBenoit Daloze
* Before this it was compiled but not used, because TruffleRuby has a stringio.rb in stdlib and .rb has precedence over .so. In fact that extension never worked on TruffleRuby, because rb_io_extract_modeenc() has never been defined on TruffleRuby. * So this just skip compiling the extension since compilation of it now fails: https://github.com/ruby/openssl/issues/699 https://github.com/ruby/stringio/commit/d791b63df6
2023-11-27[ruby/psych] Prefer each_char in Psych::Visitors::Visitor::ToRuby#deserializeMau Magnaguagno
Use safe navigation operator with each_char to remove empty strings and improve readability. https://github.com/ruby/psych/commit/5fe714b216
2023-11-25[ruby/openssl] History.md: Escape Markdown syntax Italic "*". [ci skip]Jun Aruga
https://github.com/ruby/openssl/commit/dc26433ae5
2023-11-22objspace_dump.c: dump call cache ids with dump_append_idJean Boussier
Not all `ID` have an associated string. Fixes a SEGFAULT in ObjectSpace.dump_all spec.
2023-11-21`ObjectSpace.count_nodes` doesn't count nodesyui-knk
Node has not been managed by GC from Ruby 2.5. Therefore these codes are not needed. If ObjectSpace depends on Node, it needs to update the file when node type is updated. Delete node related codes to avoid such update.
2023-11-20Don't try compacting ivars on Classes that are "too complex"Aaron Patterson
Too complex classes use a hash table to store ivs, and should always pin their IVs. We shouldn't touch those classes in compaction.
2023-11-13Revert "Revert "Remove SHAPE_CAPACITY_CHANGE shapes""Peter Zhu
This reverts commit 5f3fb4f4e397735783743fe52a7899b614bece20.
2023-11-13Record more info from CALLCACHE in heap dumpsJohn Hawthorn
This records the called_id and klass from imemo_callcache objects in heap dumps.
2023-11-13GVL Instrumentation: pass thread->self as part of event dataJean Boussier
Context: https://github.com/ivoanjo/gvl-tracing/pull/4 Some hooks may want to collect data on a per thread basis. Right now the only way to identify the concerned thread is to use `rb_nativethread_self()` or similar, but even then because of the thread cache or MaNy, two distinct Ruby threads may report the same native thread id. By passing `thread->self`, hooks can use it as a key to store the metadata. NB: Most hooks are executed outside the GVL, so such data collection need to use a thread-safe data-structure, and shouldn't use the reference in other ways from inside the hook. They must also either pin that value or handle compaction.
2023-11-10Revert "Remove SHAPE_CAPACITY_CHANGE shapes"Peter Zhu
This reverts commit f6910a61122931e4193bcc0fad18d839c319b720. We're seeing crashes in the test suite of Shopify's core monolith after this change.
2023-11-10[ruby/io-console] bump up to 0.6.1.dev.1Nobuyoshi Nakada
https://github.com/ruby/io-console/commit/057ab96a73
2023-11-10[ruby/io-console] Include FFI version version.rbNobuyoshi Nakada
https://github.com/ruby/io-console/commit/b0c688c57e
2023-11-10[ruby/io-console] Define IO::ConsoleMode::VERSION from gemspecNobuyoshi Nakada
https://github.com/ruby/io-console/commit/ebdbebf461