Граф коммитов

16880 Коммитов

Автор SHA1 Сообщение Дата
Peter Zhu a23ae56c4d Add REMEMBERED_WB_UNPROTECTED_OBJECTS_LIMIT_RATIO
[Feature #19571]

This commit adds the environment variable
`RUBY_GC_HEAP_REMEMBERED_WB_UNPROTECTED_OBJECTS_LIMIT_RATIO` which is
used to calculate the `remembered_wb_unprotected_objects_limit` using a
ratio of `old_objects`. This should improve performance by reducing
major GC because, in a major GC, we mark all of the old objects, so we
should have more uncollectible WB unprotected objects before starting a
major GC. The default has been set to 0.01 (1% of old objects).

On one of [Shopify's highest traffic Ruby apps, Storefront Renderer](https://shopify.engineering/how-shopify-reduced-storefront-response-times-rewrite),
we saw significant improvements after deploying this patch in
production. In the graphs below, we have the `tuned` group which uses
`RUBY_GC_HEAP_REMEMBERED_WB_UNPROTECTED_OBJECTS_LIMIT_RATIO=0.01` (the
default value), and an `untuned` group, which turns this feature off
with `RUBY_GC_HEAP_REMEMBERED_WB_UNPROTECTED_OBJECTS_LIMIT_RATIO=0`. We
see that the tuned group spends significantly less time in GC, on
average 0.67x of the time compared to the untuned group and 0.49x for
p99. We see this improvement in GC time translate to improvements in
response times. The average response time is now 0.96x of the time
compared to the untuned group and 0.86x for p99.

https://user-images.githubusercontent.com/15860699/229559078-e23e8ce4-5f1f-4a2f-b5ef-5769f92b8c70.png
2023-05-24 12:11:48 -04:00
Nobuyoshi Nakada 1ea9bb8496
[ruby/racc] Add a newline at EOF [ci skip]
https://github.com/ruby/racc/commit/8f1dab6759
2023-05-24 15:02:49 +09:00
Samuel Williams 135a0d26a1
Improvements to `IO::Buffer` `read`/`write`/`pread`/`pwrite`. (#7826)
- Fix IO::Buffer `read`/`write` to use a minimum length.
2023-05-24 10:17:35 +09:00
Ufuk Kayserilioglu 12dfd9d1c9
[flori/json] Call `super` in `included` hook
The C extension defines an `included` hook for the
`JSON::Ext::Generator::GeneratorMethods::String` module but neglects to
call `super` in the hook. This can break the functionality of various
other code that rely on the fact that `included` on `Module` will always
be called.

https://github.com/flori/json/commit/cd8bbe56a3
2023-05-24 09:37:30 +09:00
Peter Zhu a86f798fc2 Fix crash when replacing ST hash with AR hash
With VWA, AR hashes are much larger than ST hashes. Hash#replace
attempts to directly copy the contents of AR hashes into ST hashes so
there will be memory corruption caused by writing past the end of memory.

This commit changes it so that if a ST hash is being replaced with an AR
hash it will insert each element into the ST hash.
2023-05-23 15:27:56 -04:00
Jenny Shen 061e01ee50 [rubygems/rubygems] Remove forward slash in key regardless if it contains __
https://github.com/rubygems/rubygems/commit/33a02eec00
2023-05-23 18:37:09 +00:00
TSUYUSATO Kitsune 92d6c9a7b1 [ruby/irb] Allow `show_source` for private methods
(https://github.com/ruby/irb/pull/589)

* Allow `show_source` for private methods

Fix https://github.com/ruby/irb/pull/577

* Pend tests on TruffleRuby

It seems `eval(..., __LINE__ + 1)` does not work.
Other similar tests are also pended on TruffleRuby, so I think it
is acceptable.

* Use `private_method_defined?` instead of `defined?`
2023-05-23 16:16:37 +00:00
Charles Oliver Nutter f890345c03 Ensure producer threads do not start running early
This test caused issues occasionally on JRuby because it's
possible for a producer thread to run to completion before the
status checks begin. This results in Thread#status returning false
and the =~ call triggering a warning (3.1) or error (3.2) and
either emitting thousands of deprecation warnings or failing
outright.

The patch here introduces a mutex that remains locked until all
producer threads are seen to have started. The lock is then
released and the test proceeds. This prevents any producers from
running to completion, which in turn prevents consumers running to
completion, avoiding the warnings or error calling =~ on false.

This patch also modifies the status checks to to_s the thread
status, preventing any prematurely terminated threads from
triggering similar deprecation warnings or missing method errors
when =~ is called on nil.
2023-05-22 20:49:53 -04:00
Jun Aruga b0a25c9cf8
Revert "Apply timeout-scale to test_thr_kill." (#7838)
This reverts commit bbbec4b87c.
Because the commit is a bug. The `apply_timeout_scale` to scale the timeout is
called 2 times in the process.

The `test/ruby/test_thread_queue.rb#test_thr_kill` is calling
`EnvUtil.apply_timeout_scale`, and
calling `tool/lib/core_assertions.rb#assert_normal_exit`.
calling `tool/lib/envutil.rb#invoke_ruby` (`EnvUtil.invoke_ruby`)
calling the `apply_timeout_scale`.

```
$ make test-all V=1 TESTS="-v test/ruby/test_thread_queue.rb -n TestThreadQueue#test_thr_kill --timeout-scale=2"
```
2023-05-22 14:53:05 +02:00
Samuel Williams bd786e7896
Fix mutation on shared strings. (#7837) 2023-05-22 12:58:17 +09:00
TSUYUSATO Kitsune a5819b5b25
Allow the match cache optimization for atomic groups (#7804) 2023-05-22 11:27:34 +09:00
Samuel Williams 872249e209
Don't leak pipes. (#7820) 2023-05-22 08:49:33 +09:00
Nobuyoshi Nakada 4f4bc13eb9
Skip too-complex-shape test which is always flaky regardless JIT 2023-05-21 16:44:10 +09:00
ima1zumi 64e156f20c [ruby/irb] Fix typo (https://github.com/ruby/irb/pull/587)
* Fix typo

* s/braking/breaking/g

Co-authored-by: Stan Lo <stan001212@gmail.com>

---------

https://github.com/ruby/irb/commit/5f8e69f5f2

Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-05-21 02:57:50 +00:00
Nobuyoshi Nakada a997f144fb
Skip first if flaky [ci skip] 2023-05-21 10:31:38 +09:00
Jeremy Evans b3f355cfbe Set rlimit_nproc to 64 instead of 128 on OpenBSD for spawn_too_long_path tests
This significantly reduces testing time, and may allow the test to
pass before timeout in CI.
2023-05-20 13:40:46 -07:00
Stan Lo 9ce6c08caf [ruby/irb] Add assertion for dynamic_prompt's assertion execution
(https://github.com/ruby/irb/pull/586)

Because the assertions for `dynamic_prompt` lives inside a block given to
`RubyLex`, they could be skipped unnoticed if the setup is not correct.

This commit adds a simple assertion to check if the block was actually
executed.
2023-05-20 04:28:23 +00:00
tomoya ishida 6d9875ccbf [ruby/irb] Fix dynamic_prompt test not executed, remove unnecessary
set_input
(https://github.com/ruby/irb/pull/585)

https://github.com/ruby/irb/commit/b5f3efdcf0
2023-05-20 01:08:58 +00:00
tomoya ishida e8c9f727e8 [ruby/irb] Simplify each_top_level_statement
(https://github.com/ruby/irb/pull/576)

* Simplify each_top_level_statement, reduce instance vars

* Update lib/irb/ruby-lex.rb

Co-authored-by: Stan Lo <stan001212@gmail.com>

* Remove unused ltype from TestRubyLex#check_state response

* Remove unnecessary const path of TerminateLineInput

* Combine duplicated code state check into method

---------

https://github.com/ruby/irb/commit/172453cec4

Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-05-19 13:48:08 +00:00
Takashi Kokubun 875adad948 The too-complex test isn't stablefor RJIT either
https://github.com/ruby/ruby/actions/runs/5020231516
2023-05-19 12:56:15 +09:00
Takashi Kokubun b70e3f44c1 Skip test_dump_too_complex_shape for YJIT for now
It fails too often with YJIT:

* https://github.com/ruby/ruby/actions/runs/5015976941/jobs/8992254690
* https://github.com/ruby/ruby/actions/runs/5017310353/jobs/8995281395
* https://github.com/ruby/ruby/actions/runs/5019625711/jobs/9000322487
* https://github.com/ruby/ruby/actions/runs/5019883965/jobs/9000836915

ref: https://github.com/ruby/ruby/pull/7646
2023-05-19 11:33:19 +09:00
Hiroshi SHIBATA 74600917a8 [ruby/openssl] Revert "Skip OpenSSL::TestHMAC#test_dup when running with RHEL9"
This reverts commit https://github.com/ruby/openssl/commit/9493d4a3bb26.

https://github.com/ruby/openssl/commit/b880a023dd
2023-05-19 09:25:11 +09:00
Jun Aruga 678d41bc51 [ruby/openssl] Implement FIPS functions on OpenSSL 3.
This commit is to implement the `OpenSSL::OPENSSL_FIPS`, `ossl_fips_mode_get`
and `ossl_fips_mode_set` to pass the test `test/openssl/test_fips.rb`.

It seems that the `OPENSSL_FIPS` macro is not used on the FIPS mode case any
more, and some FIPS related APIs also were removed in OpenSSL 3.

See the document <https://github.com/openssl/openssl/blob/master/doc/man7/migration_guide.pod#removed-fips_mode-and-fips_mode_set>
the section OPENSSL 3.0 > Main Changes from OpenSSL 1.1.1 >
Other notable deprecations and changes - Removed FIPS_mode() and FIPS_mode_set() .

The `OpenSSL::OPENSSL_FIPS` returns always true in OpenSSL 3 because the used
functions `EVP_default_properties_enable_fips` and `EVP_default_properties_is_fips_enabled`
works with the OpenSSL installed without FIPS option.

The `TEST_RUBY_OPENSSL_FIPS_ENABLED` is set on the FIPS mode case on the CI.
Because I want to test that the `OpenSSL.fips_mode` returns the `true` or
'false' surely in the CI. You can test the FIPS mode case by setting
`TEST_RUBY_OPENSSL_FIPS_ENABLED` on local too. Right now I don't find a better
way to get the status of the FIPS mode enabled or disabled for this purpose. I
am afraid of the possibility that the FIPS test case is unintentionally skipped.

I also replaced the ambiguous "returns" with "should return" in the tests.

https://github.com/ruby/openssl/commit/c5b2bc1268
2023-05-19 09:25:10 +09:00
Jun Aruga 741a3bd5a5 [ruby/openssl] CI: Add OpenSSL FIPS mode case.
test/openssl/fixtures/ssl/openssl_fips.cnf.tmpl:

I referred to the following document for the openssl config file for FIPS mode.
<https://www.openssl.org/docs/manmaster/man7/fips_module.html>
- Making all applications use the FIPS module by default

It seems that the `.include` syntax only requires the absolute path.
So, the placeholder OPENSSL_DIR in the template file is replaced with the
actual OpenSSL directory.

.github/workflows/test.yml:

The `TEST_RUBY_OPENSSL_FIPS_ENABLED` environment variable is set
in the FIPS mode CI case. It can be used in the unit tests.

https://github.com/ruby/openssl/commit/18b017218c
2023-05-19 09:25:10 +09:00
Stan Lo cfb7997353 [ruby/irb] Refactor RubyLex's input/io methods
(https://github.com/ruby/irb/pull/583)

1. Make `RubyLex#set_input` simply assign the input block. This matches
   the behavior of `RubyLex#set_prompt`.
2. Merge `RubyLex#set_input`'s IO configuration logic with `#set_auto_indent`
   into `#configure_io`.
2023-05-18 19:00:33 +00:00
lukeg d74b32db9d
change to test/objectspace, don't rely on Object's shape not being "too complex" 2023-05-18 09:17:24 -07:00
Stan Lo b695f58d52 [ruby/irb] Print deprecation warning for `help` command
(https://github.com/ruby/irb/pull/567)

* Give show_doc its own command class

* Print deprecation warning for `help` command
2023-05-18 03:28:31 +00:00
Peter Zhu cea9c30fa5 Move ar_hint to ar_table_struct
This allows Hashes with ST tables to fit int he 80 byte size pool.
2023-05-17 09:19:40 -04:00
Peter Zhu 5199f2aaf9 Implement Hash AR tables on VWA 2023-05-17 09:19:40 -04:00
tomoya ishida 264ba0f89a [ruby/irb] Fix Test timedout in test_debug_cmd
(https://github.com/ruby/irb/pull/582)

* Suppress Reline::IOGate.cursor_pos writing escape sequence in test_debug_cmd

* Force use Reline::GeneralIO as Reline::IOGate and remove RUBY_DEBUG_NO_RELINE option for debug test
2023-05-17 04:42:32 +00:00
dependabot[bot] 0052132025 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.75 to 0.9.77.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.75...v0.9.77)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-15 21:49:01 +00:00
KJ Tsanaktsidis 8bd4d8867a
Unskip the test skipped in #4173 (#7809)
This test was skipped 12 years ago because it was flaky on FreeBSD and
OpenBSD. Since then, Ruby's SIGCHLD handling has been substantially
re-written (mostly by Eric Wong @normalperson in 44fc3d08).

These tests now in fact pass reliably on Ruby master on FreeBSD 13.2 and
OpenBSD 7.3. I stress-tested the test_wait_and_sigchild test on my
laptop by running four copies of the test in a loop on a 8-core VM; both
by itself and also as part of the whole test_process.rb file. I did not
see any failures.

Let's unskip the test and close [#4173] out. I'll keep an eye out on Ruby
CI for any flakes in this file on BSD after this gets merged, but if we
don't see any I'm going to assume 44fc3d08 or related changes around
that time accidently fixed this bug.

It's also probably important to unskip this test so that if another
attempt at removing the special SIGCHLD handling is made (like was
reverted in https://github.com/ruby/ruby/pull/7517), we get signal if
that breaks on FreeBSD/OpenBSD.

[Fixes #4173]
2023-05-15 13:37:28 +09:00
Samuel Williams 0b2613f443
`rb_io_puts` should not write zero length strings. (#7806) 2023-05-15 11:13:51 +09:00
Nobuyoshi Nakada 91c004885f
[Bug #19025] Numbered parameter names are always local variables 2023-05-14 22:16:15 +09:00
Yusuke Endoh a19fa9b2bd Prevent warning: assigned but unused variable
http://rubyci.s3.amazonaws.com/debian10/ruby-master/log/20230510T123003Z.log.html.gz
```
/home/chkbuild/chkbuild/tmp/build/20230510T123003Z/ruby/test/objspace/test_objspace.rb:224: warning: assigned but unused variable - c4
/home/chkbuild/chkbuild/tmp/build/20230510T123003Z/ruby/test/ruby/test_class.rb:362: warning: assigned but unused variable - e
/home/chkbuild/chkbuild/tmp/build/20230510T123003Z/ruby/test/ruby/test_process.rb:2602: warning: assigned but unused variable - parent_pid
```
2023-05-10 23:49:44 +09:00
Nobuyoshi Nakada 2d9bc3efe5 [Bug #19597] Freeze script name 2023-05-10 17:14:20 +09:00
Hiroshi SHIBATA 507801c6d7
ext/readline is retired 2023-05-10 09:52:33 +09:00
Hiroshi SHIBATA 59fd67fc3d Extract ext/readline 2023-05-09 12:57:12 +09:00
tomoya ishida 5eca327fc5 [ruby/reline] Fix dialog corrupts rendering by pushing up input line
too much
(https://github.com/ruby/reline/pull/524)

* Do not render dialog where it overflows screen

* Dialog rendering should Scroll down only when needed

* Refactor screen_y_range calculation

Co-authored-by: Stan Lo <stan001212@gmail.com>

---------

https://github.com/ruby/reline/commit/bc0e3d1310

Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-05-07 13:18:13 +00:00
Nobuyoshi Nakada da75560b6c
Continue checking all gemspec files after errors 2023-05-05 18:52:37 +09:00
Nobuyoshi Nakada cc4c28d0ce [ruby/uri] Define test cases as qualified class names
https://github.com/ruby/uri/commit/aaa22a2443
2023-05-05 00:46:11 +00:00
Nobuyoshi Nakada c598bc4603 [ruby/uri] Increase repeat orders of magnitude
https://github.com/ruby/uri/commit/cfbeade935
2023-05-05 00:46:10 +00:00
Nobuyoshi Nakada caa2180be0 test_default_gems.rb: Stop using `git ls-files`
Just validate syntax and the result class instead.

Not only `git ls-files` doesn't make sence under ruby's repository,
some gemspec files hardcode `2>/dev/null`, which doesn't work of
course on other than Unix-like platforms.
2023-05-04 18:05:24 +09:00
Nobuyoshi Nakada e135a21a85
Define `RubyVM::Shape` dependent test only if available 2023-05-04 13:41:30 +09:00
Jean Boussier 04ee666aab Make the maximum shapes variation warning non-verbose
[Feature #19538]

Since that category is not enabled by default, making it a
verbose warning is redundant. Enabling performance warning should
work with the default verbosity level.
2023-05-03 10:43:46 +02:00
Nobuyoshi Nakada 5dfeffc614
Allow EPIPE when the child process has exited before interrupt 2023-05-02 22:40:43 +09:00
Nobuyoshi Nakada b15e88e0fc
[Bug #19619] Preserve numbered parameters context
Preserve numbered parameters context across method definitions
2023-05-02 17:39:18 +09:00
Nobuyoshi Nakada 3833d0fee6 [ruby/rdoc] Fix references to nested label in table_of_contents
Fixes https://github.com/ruby/rdoc/pull/1000

https://github.com/ruby/rdoc/commit/291e2b7e8b
2023-05-02 04:19:46 +00:00
dependabot[bot] cf861c9477 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.74 to 0.9.75.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.74...v0.9.75)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-02 00:04:44 +00:00
tomoya ishida 13dfbcf7bf [ruby/reline] Rewrite dialog rendering
(https://github.com/ruby/reline/pull/492)

* Rewrite dialog rendering

* Fix failing test of dialog with small screen

* Add multiple-dialog rendering test

* Add description comments for each part of render_dialog_changes
2023-05-01 12:20:20 +00:00