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

16896 Коммитов

Автор SHA1 Сообщение Дата
Peter Zhu e4163112f6 More debug code to GC compaction test 2023-05-31 16:16:50 -04:00
Peter Zhu e8212c55f9 Fix flaky test in test_objspace.rb
Ensure that the frozen string is promoted to the old generation by
running the GC 4 times.
2023-05-31 14:03:30 -04:00
Peter Zhu 1ac17693de Add debug code to GC compaction test
This test is flaky on some CI systems.
2023-05-31 09:22:52 -04:00
Hiroshi SHIBATA 4bbeed6134 Merge RubyGems/Bundler master from 4076391fce5847689bf2ec402b17133fe4e32285 2023-05-30 21:50:07 +09:00
dependabot[bot] 7ddcd0622f [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.77 to 0.9.78.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.77...v0.9.78)

---
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-29 21:24:22 +00:00
Benoit Daloze f61bd3ca80 [ruby/cgi] Add TruffleRuby support and add it in CI
https://github.com/ruby/cgi/commit/1240fec9c9
2023-05-29 19:33:38 +00:00
Jun Aruga 57459b83a9
mkmf: Add the extra option `--with-verbose` to enable verbose mode. (#7863)
This commit is to add an extra option to enable verbose mode (V=1) in the
generated `Makefile` at runtime of the Ruby to print compiler command lines by
the commands below when building native extensions. It's possible to enable the
verbose mode by setting the environment variable `MAKEFLAGS="V=1"`[1]
implemented in GNU make. However, I wanted to make a consistent user-interface
not depending on the specific make's implementation.

```
$ ruby /path/to/extconf.rb -- --with-verbose
```

You can also add the extra option via rake-compiler gem.

```
$ rake compiler -- --with-verbose
```

If the extra option is not given, the value of the
`RbConfig::CONFIG["MKMF_VERBOSE"]` enabled by the configure option below is
used.

```
$ ./configure --enable-mkmf-verbose
```

For the unit tests, updated the following files.

* The `test/mkmf/test_configuration.rb` was created to test the cases with the
  `configuration` method and this implementation.
* Updated the `TestMkmf#assert_separately` to set the extra
  arguments in `test/mkmf/base.rb`. Updated tests using the `assert_separately`.
* Added tests for `MakeMakefile#with_config` in the `test/mkmf/test_config.rb`.

[1] https://www.gnu.org/software/make/manual/html_node/Variables_002fRecursion.html

Fixes [Bug #19695]

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-05-29 10:09:32 +02:00
tomoya ishida cf0b9e0db0 [ruby/reline] Fix scrolldown condition in dialog rendering
(https://github.com/ruby/reline/pull/541)

https://github.com/ruby/reline/commit/ad6faada3f
2023-05-27 15:07:29 +00:00
tomoya ishida 5d137a7f77 [ruby/reline] Use appropriate dialog height and reduce screen pushup
problem
(https://github.com/ruby/reline/pull/542)

* Provide preferred_dialog_height for dialog positioning

* Fix rendering test
2023-05-27 14:48:50 +00:00
Samuel Williams bf1bc5362e
Improve `read`/`write`/`pread`/`pwrite` consistency. (#7860)
* Documentation consistency.

* Improve consistency of `pread`/`pwrite` implementation when given length.

* Remove HAVE_PREAD / HAVE_PWRITE - it is no longer optional.
2023-05-27 18:48:47 +09:00
KJ Tsanaktsidis d1628feaaf Remvoe very high timeout on test_race_gets_and_close
This test should be fixed and fast now because the closing thread sleeps
appropriately waiting for the file descriptor to be unused.
2023-05-26 14:51:23 +09:00
KJ Tsanaktsidis 8c4da473de Remove excessive timeout on test_wait_exception for FreeBSD
This should now be fixed by the previous commit.
2023-05-26 14:48:08 +09:00
Sutou Kouhei d83f32c34b [rubygems/rubygems] Load plugin immediately
We can install RubyGems plugin by "gem install XXX". The installed
plugin is used from the NEXT "gem ...".

For example, "gem install gem-src kaminari" doesn't use gem-src plugin
for kaminari. "gem install gem-src && gem install kaminari" uses
gem-src plugin for kaminari.

How about loading a plugin immediately when the plugin is installed?
If this proposal is implemented, "gem install gem-src kaminari" works
like "gem install gem-src && gem install kaminari".

https://github.com/rubygems/rubygems/commit/4917d96f4c
2023-05-25 21:51:15 +00:00
Peter Zhu e87f6c899e Don't immediately promote children of old objects
[Feature #19678]

References from an old object to a write barrier protected young object
will not immediately promote the young object. Instead, the young object
will age just like any other object, meaning that it has to survive
three collections before being promoted to the old generation.
References from an old object to a write barrier unprotected object will
place the parent object in the remember set for marking during minor
collections. This allows the child object to be reclaimed in minor
collections at the cost of increased time for minor collections.

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 feature in
production. We compare the GC time and response time of web workers that
have the original behaviour (non-experimental group) and this new
behaviour (experimental group). We see that with this feature we spend
significantly less time in the GC, 0.81x on average, 0.88x on p99, and
0.45x on p99.9.

This translates to improvements in average response time (0.96x) and p99
response time (0.92x).
2023-05-25 08:56:22 -04:00
Nobuyoshi Nakada 31b28b31fa [ruby/csv] Support RJIT (https://github.com/ruby/csv/pull/281)
In Ruby 3.3, MJIT is replaced with RJIT.

https://github.com/ruby/csv/commit/cc6b47a4a7
2023-05-25 01:44:17 +09:00
Luke Gruber 38ef537ce0 [ruby/csv] test: rename Helper to CSVHelper
(https://github.com/ruby/csv/pull/278)

Rename it so that in ruby/ruby, the generic name Helper is not used.
2023-05-25 01:44:17 +09:00
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