Skip to content

Possible fix for 8809#8810

Merged
headius merged 5 commits intojruby:masterfrom
NGRsoftlab:Fix-8809
Jan 30, 2026
Merged

Possible fix for 8809#8810
headius merged 5 commits intojruby:masterfrom
NGRsoftlab:Fix-8809

Conversation

@ngr-ilmarh
Copy link
Contributor

Some refactoring for #8809

Some refactoring
@headius
Copy link
Member

headius commented Apr 30, 2025

Please check the syntax and re-target against jruby-9.4 branch. Thank you for your help!

@headius headius added this to the JRuby 9.4.13.0 milestone Apr 30, 2025
@headius
Copy link
Member

headius commented Apr 30, 2025

I'm not sure this is exactly the right fix. Looking through all callers, it seems like they all actually just pass in int. This probably was a refactoring gone bad. Perhaps you could review the calling code and see if there's every a case that could be null? If not, then there's no reason for it to be an Integer instead of an int.

@ngr-ilmarh
Copy link
Contributor Author

Fixed lost bracket. I'll try to trace back this call, it seems, that you maybe right. At the first glance i've found to call:

    public IRubyObject createCallerLocations(int level, Integer length, Stream<StackWalker.StackFrame> stackStream) {
        runtime.incrementCallerCount();

        RubyStackTraceElement[] fullTrace = getPartialTrace(level, length, stackStream);

and

    public IRubyObject createCallerBacktrace(int level, int length, Stream<StackWalker.StackFrame> stackStream) {
        runtime.incrementCallerCount();

        RubyStackTraceElement[] fullTrace = getPartialTrace(level, length, stackStream);

one with int, another with Integer. Hope i'll be back with more complex solution

@ngr-ilmarh
Copy link
Contributor Author

Here is new proposal, it passed tests in 9.4.10.0, but failing on master (10.0.1.0).
If think that these faults are not related, but not sure

~/Projects-hdd/Original/jruby$ ./bin/jruby -S rake test:mri
/home/ilmar/Projects-hdd/Original/jruby/bin/jruby test/mri/runner.rb  --excludes=test/mri/excludes -q -- ruby/enc/test_big5.rb ruby/enc/test_case_comprehensive.rb ruby/enc/test_case_mapping.rb ruby/enc/test_case_options.rb ruby/enc/test_cesu8.rb ruby/enc/test_cp949.rb ruby/enc/test_emoji.rb ruby/enc/test_emoji_breaks.rb ruby/enc/test_euc_jp.rb ruby/enc/test_euc_kr.rb ruby/enc/test_euc_tw.rb ruby/enc/test_gb18030.rb ruby/enc/test_gbk.rb ruby/enc/test_grapheme_breaks.rb ruby/enc/test_iso_8859.rb ruby/enc/test_koi8.rb ruby/enc/test_regex_casefold.rb ruby/enc/test_shift_jis.rb ruby/enc/test_utf16.rb ruby/enc/test_utf32.rb ruby/enc/test_windows_1251.rb ruby/enc/test_windows_1252.rb ruby/test_alias.rb ruby/test_arithmetic_sequence.rb ruby/test_arity.rb ruby/test_array.rb ruby/test_assignment.rb ruby/test_autoload.rb ruby/test_backtrace.rb ruby/test_basicinstructions.rb ruby/test_beginendblock.rb ruby/test_bignum.rb ruby/test_call.rb ruby/test_case.rb ruby/test_class.rb ruby/test_clone.rb ruby/test_comparable.rb ruby/test_complex.rb ruby/test_complex2.rb ruby/test_complexrational.rb ruby/test_condition.rb ruby/test_const.rb ruby/test_continuation.rb ruby/test_data.rb ruby/test_defined.rb ruby/test_dir.rb ruby/test_dir_m17n.rb ruby/test_dup.rb ruby/test_econv.rb ruby/test_encoding.rb ruby/test_enum.rb ruby/test_enumerator.rb ruby/test_env.rb ruby/test_eval.rb ruby/test_exception.rb ruby/test_fiber.rb ruby/test_file.rb ruby/test_file_exhaustive.rb ruby/test_fixnum.rb ruby/test_flip.rb ruby/test_float.rb ruby/test_fnmatch.rb ruby/test_frozen.rb ruby/test_frozen_error.rb ruby/test_gc.rb ruby/test_hash.rb ruby/test_ifunless.rb ruby/test_inlinecache.rb ruby/test_integer.rb ruby/test_integer_comb.rb ruby/test_io.rb ruby/test_io_buffer.rb ruby/test_io_m17n.rb ruby/test_io_timeout.rb ruby/test_iterator.rb ruby/test_key_error.rb ruby/test_keyword.rb ruby/test_lambda.rb ruby/test_lazy_enumerator.rb ruby/test_literal.rb ruby/test_m17n.rb ruby/test_m17n_comb.rb ruby/test_marshal.rb ruby/test_math.rb ruby/test_metaclass.rb ruby/test_method.rb ruby/test_method_cache.rb ruby/test_mixed_unicode_escapes.rb ruby/test_module.rb ruby/test_name_error.rb ruby/test_nomethod_error.rb ruby/test_not.rb ruby/test_numeric.rb ruby/test_object.rb ruby/test_optimization.rb ruby/test_pack.rb ruby/test_parse.rb ruby/test_path.rb ruby/test_pattern_matching.rb ruby/test_pipe.rb ruby/test_primitive.rb ruby/test_proc.rb ruby/test_rand.rb ruby/test_random_formatter.rb ruby/test_range.rb ruby/test_rational.rb ruby/test_rational2.rb ruby/test_readpartial.rb ruby/test_refinement.rb ruby/test_regexp.rb ruby/test_require.rb ruby/test_rubyoptions.rb ruby/test_sleep.rb ruby/test_sprintf.rb ruby/test_sprintf_comb.rb ruby/test_stack.rb ruby/test_string.rb ruby/test_stringchar.rb ruby/test_struct.rb ruby/test_super.rb ruby/test_symbol.rb ruby/test_system.rb ruby/test_thread.rb ruby/test_thread_cv.rb ruby/test_thread_queue.rb ruby/test_threadgroup.rb ruby/test_time.rb ruby/test_time_tz.rb ruby/test_trace.rb ruby/test_transcode.rb ruby/test_undef.rb ruby/test_unicode_escape.rb ruby/test_variable.rb ruby/test_warning.rb ruby/test_weakkeymap.rb ruby/test_weakmap.rb ruby/test_whileuntil.rb
Ignoring date-3.4.1 because its extensions are not built. Try: gem pristine date --version 3.4.1
Ignoring debug-1.10.0 because its extensions are not built. Try: gem pristine debug --version 1.10.0
Ignoring debug-1.9.1 because its extensions are not built. Try: gem pristine debug --version 1.9.1
Ignoring executable-hooks-1.7.1 because its extensions are not built. Try: gem pristine executable-hooks --version 1.7.1
Ignoring gem-wrappers-1.4.0 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.4.0
Ignoring io-console-0.8.0 because its extensions are not built. Try: gem pristine io-console --version 0.8.0
Ignoring prism-1.4.0 because its extensions are not built. Try: gem pristine prism --version 1.4.0
Ignoring psych-5.2.3 because its extensions are not built. Try: gem pristine psych --version 5.2.3
Ignoring racc-1.7.3 because its extensions are not built. Try: gem pristine racc --version 1.7.3
Ignoring rbs-3.9.2 because its extensions are not built. Try: gem pristine rbs --version 3.9.2
Ignoring rbs-3.4.0 because its extensions are not built. Try: gem pristine rbs --version 3.4.0
Ignoring stringio-3.1.6 because its extensions are not built. Try: gem pristine stringio --version 3.1.6
Ignoring date-3.4.1 because its extensions are not built. Try: gem pristine date --version 3.4.1
Ignoring debug-1.10.0 because its extensions are not built. Try: gem pristine debug --version 1.10.0
Ignoring debug-1.9.1 because its extensions are not built. Try: gem pristine debug --version 1.9.1
Ignoring executable-hooks-1.7.1 because its extensions are not built. Try: gem pristine executable-hooks --version 1.7.1
Ignoring gem-wrappers-1.4.0 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.4.0
Ignoring io-console-0.8.0 because its extensions are not built. Try: gem pristine io-console --version 0.8.0
Ignoring prism-1.4.0 because its extensions are not built. Try: gem pristine prism --version 1.4.0
Ignoring psych-5.2.3 because its extensions are not built. Try: gem pristine psych --version 5.2.3
Ignoring racc-1.7.3 because its extensions are not built. Try: gem pristine racc --version 1.7.3
Ignoring rbs-3.9.2 because its extensions are not built. Try: gem pristine rbs --version 3.9.2
Ignoring rbs-3.4.0 because its extensions are not built. Try: gem pristine rbs --version 3.4.0
Ignoring stringio-3.1.6 because its extensions are not built. Try: gem pristine stringio --version 3.1.6
Ignoring date-3.4.1 because its extensions are not built. Try: gem pristine date --version 3.4.1
Ignoring debug-1.10.0 because its extensions are not built. Try: gem pristine debug --version 1.10.0
Ignoring debug-1.9.1 because its extensions are not built. Try: gem pristine debug --version 1.9.1
Ignoring executable-hooks-1.7.1 because its extensions are not built. Try: gem pristine executable-hooks --version 1.7.1
Ignoring gem-wrappers-1.4.0 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.4.0
Ignoring io-console-0.8.0 because its extensions are not built. Try: gem pristine io-console --version 0.8.0
Ignoring prism-1.4.0 because its extensions are not built. Try: gem pristine prism --version 1.4.0
Ignoring psych-5.2.3 because its extensions are not built. Try: gem pristine psych --version 5.2.3
Ignoring racc-1.7.3 because its extensions are not built. Try: gem pristine racc --version 1.7.3
Ignoring rbs-3.9.2 because its extensions are not built. Try: gem pristine rbs --version 3.9.2
Ignoring rbs-3.4.0 because its extensions are not built. Try: gem pristine rbs --version 3.4.0
Ignoring stringio-3.1.6 because its extensions are not built. Try: gem pristine stringio --version 3.1.6
Run options: 
  --seed=16157
  --excludes=test/mri/excludes
  -q
  --

# Running tests:

[ 253/6455] TestException#test_exception_in_message = 2.04 s                                                                          
  1) Error:
TestException#test_exception_in_message:
Timeout::Error: execution of assert_in_out_err expired timeout (2 sec)
pid 2557807 exit 143
| 

    /home/ilmar/Projects-hdd/Original/jruby/test/mri/ruby/test_exception.rb:1381:in 'test_exception_in_message'

[1259/6455] TestIO#test_read_commandorg/jruby/RubyIO.java:1670:in 'write': Broken pipe - <STDOUT> (Errno::EPIPE)       
        from org/jruby/RubyIO.java:1572:in 'write'
        from org/jruby/RubyIO.java:3011:in 'write'
        from org/jruby/RubyIO.java:2854:in 'puts'
        from org/jruby/RubyKernel.java:744:in 'puts'
        from -e:1:in '<main>'
[1369/6455] TestIO#test_close_readorg/jruby/RubyIO.java:1670:in 'write': Broken pipe - <STDOUT> (Errno::EPIPE)
        from org/jruby/RubyIO.java:1560:in 'write'
        from -e:1:in '<main>'
[1417/6455] TestRequire#test_load_error_pathIgnoring date-3.4.1 because its extensions are not built. Try: gem pristine date --version 3.4.1
Ignoring debug-1.10.0 because its extensions are not built. Try: gem pristine debug --version 1.10.0
Ignoring debug-1.9.1 because its extensions are not built. Try: gem pristine debug --version 1.9.1
Ignoring executable-hooks-1.7.1 because its extensions are not built. Try: gem pristine executable-hooks --version 1.7.1
Ignoring gem-wrappers-1.4.0 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.4.0
Ignoring io-console-0.8.0 because its extensions are not built. Try: gem pristine io-console --version 0.8.0
Ignoring prism-1.4.0 because its extensions are not built. Try: gem pristine prism --version 1.4.0
Ignoring psych-5.2.3 because its extensions are not built. Try: gem pristine psych --version 5.2.3
Ignoring racc-1.7.3 because its extensions are not built. Try: gem pristine racc --version 1.7.3
Ignoring rbs-3.9.2 because its extensions are not built. Try: gem pristine rbs --version 3.9.2
Ignoring rbs-3.4.0 because its extensions are not built. Try: gem pristine rbs --version 3.4.0
Ignoring stringio-3.1.6 because its extensions are not built. Try: gem pristine stringio --version 3.1.6
[1418/6455] TestRequire#test_relativeIgnoring date-3.4.1 because its extensions are not built. Try: gem pristine date --version 3.4.1
Ignoring debug-1.10.0 because its extensions are not built. Try: gem pristine debug --version 1.10.0
Ignoring debug-1.9.1 because its extensions are not built. Try: gem pristine debug --version 1.9.1
Ignoring executable-hooks-1.7.1 because its extensions are not built. Try: gem pristine executable-hooks --version 1.7.1
Ignoring gem-wrappers-1.4.0 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.4.0
Ignoring io-console-0.8.0 because its extensions are not built. Try: gem pristine io-console --version 0.8.0
Ignoring prism-1.4.0 because its extensions are not built. Try: gem pristine prism --version 1.4.0
Ignoring psych-5.2.3 because its extensions are not built. Try: gem pristine psych --version 5.2.3
Ignoring racc-1.7.3 because its extensions are not built. Try: gem pristine racc --version 1.7.3
Ignoring rbs-3.9.2 because its extensions are not built. Try: gem pristine rbs --version 3.9.2
Ignoring rbs-3.4.0 because its extensions are not built. Try: gem pristine rbs --version 3.4.0
Ignoring stringio-3.1.6 because its extensions are not built. Try: gem pristine stringio --version 3.1.6
[3888/6455] TestDefined#test_autoloaded_noloadIgnoring date-3.4.1 because its extensions are not built. Try: gem pristine date --version 3.4.1
Ignoring debug-1.10.0 because its extensions are not built. Try: gem pristine debug --version 1.10.0
Ignoring debug-1.9.1 because its extensions are not built. Try: gem pristine debug --version 1.9.1
Ignoring executable-hooks-1.7.1 because its extensions are not built. Try: gem pristine executable-hooks --version 1.7.1
Ignoring gem-wrappers-1.4.0 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.4.0
Ignoring io-console-0.8.0 because its extensions are not built. Try: gem pristine io-console --version 0.8.0
Ignoring prism-1.4.0 because its extensions are not built. Try: gem pristine prism --version 1.4.0
Ignoring psych-5.2.3 because its extensions are not built. Try: gem pristine psych --version 5.2.3
Ignoring racc-1.7.3 because its extensions are not built. Try: gem pristine racc --version 1.7.3
Ignoring rbs-3.9.2 because its extensions are not built. Try: gem pristine rbs --version 3.9.2
Ignoring rbs-3.4.0 because its extensions are not built. Try: gem pristine rbs --version 3.4.0
Ignoring stringio-3.1.6 because its extensions are not built. Try: gem pristine stringio --version 3.1.6
[4758/6455] TestThread#test_ignore_deadlock = 1.05 s                                                                      
  2) Failure:
TestThread#test_ignore_deadlock [/home/ilmar/Projects-hdd/Original/jruby/test/mri/ruby/test_thread.rb:511]:
pid 2587104 exit 130.

1. [1/2] Assertion for "stdout"
   | <["false", ":sig"]> expected but was
   | <[]>.

[4760/6455] TestThread#test_thread_native_thread_id_across_fork_on_linuxIgnoring date-3.4.1 because its extensions are not built. Try: gem pristine date --version 3.4.1
Ignoring debug-1.10.0 because its extensions are not built. Try: gem pristine debug --version 1.10.0
Ignoring debug-1.9.1 because its extensions are not built. Try: gem pristine debug --version 1.9.1
Ignoring executable-hooks-1.7.1 because its extensions are not built. Try: gem pristine executable-hooks --version 1.7.1
Ignoring gem-wrappers-1.4.0 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.4.0
Ignoring io-console-0.8.0 because its extensions are not built. Try: gem pristine io-console --version 0.8.0
Ignoring prism-1.4.0 because its extensions are not built. Try: gem pristine prism --version 1.4.0
Ignoring psych-5.2.3 because its extensions are not built. Try: gem pristine psych --version 5.2.3
Ignoring racc-1.7.3 because its extensions are not built. Try: gem pristine racc --version 1.7.3
Ignoring rbs-3.9.2 because its extensions are not built. Try: gem pristine rbs --version 3.9.2
Ignoring rbs-3.4.0 because its extensions are not built. Try: gem pristine rbs --version 3.4.0
Ignoring stringio-3.1.6 because its extensions are not built. Try: gem pristine stringio --version 3.1.6
Finished tests in 1641.881214s, 3.3309 tests/s, 1171.4100 assertions/s.                                  
5469 tests, 1923316 assertions, 1 failures, 1 errors, 43 skips

ruby -v: jruby 10.0.1.0-SNAPSHOT (3.4.2) 2025-05-06 ffffffffff OpenJDK 64-Bit Server VM 21.0.6+7-Ubuntu-122.04.1 on 21.0.6+7-Ubuntu-122.04.1 [x86_64-linux]
rake aborted!
Command failed with status (2): [/home/ilmar/Projects-hdd/Original/jruby/bin/jruby test/mri/runner.rb  --excludes=test/mri/excludes -q -- ruby/enc/test_big5.rb ruby/enc/test_case_comprehensive.rb ruby/enc/test_case_mapping.rb ruby/enc/test_case_options.rb ruby/enc/test_cesu8.rb ruby/enc/test_cp949.rb ruby/enc/test_emoji.rb ruby/enc/test_emoji_breaks.rb ruby/enc/test_euc_jp.rb ruby/enc/test_euc_kr.rb ruby/enc/test_euc_tw.rb ruby/enc/test_gb18030.rb ruby/enc/test_gbk.rb ruby/enc/test_grapheme_breaks.rb ruby/enc/test_iso_8859.rb ruby/enc/test_koi8.rb ruby/enc/test_regex_casefold.rb ruby/enc/test_shift_jis.rb ruby/enc/test_utf16.rb ruby/enc/test_utf32.rb ruby/enc/test_windows_1251.rb ruby/enc/test_windows_1252.rb ruby/test_alias.rb ruby/test_arithmetic_sequence.rb ruby/test_arity.rb ruby/test_array.rb ruby/test_assignment.rb ruby/test_autoload.rb ruby/test_backtrace.rb ruby/test_basicinstructions.rb ruby/test_beginendblock.rb ruby/test_bignum.rb ruby/test_call.rb ruby/test_case.rb ruby/test_class.rb ruby/test_clone.rb ruby/test_comparable.rb ruby/test_complex.rb ruby/test_complex2.rb ruby/test_complexrational.rb ruby/test_condition.rb ruby/test_const.rb ruby/test_continuation.rb ruby/test_data.rb ruby/test_defined.rb ruby/test_dir.rb ruby/test_dir_m17n.rb ruby/test_dup.rb ruby/test_econv.rb ruby/test_encoding.rb ruby/test_enum.rb ruby/test_enumerator.rb ruby/test_env.rb ruby/test_eval.rb ruby/test_exception.rb ruby/test_fiber.rb ruby/test_file.rb ruby/test_file_exhaustive.rb ruby/test_fixnum.rb ruby/test_flip.rb ruby/test_float.rb ruby/test_fnmatch.rb ruby/test_frozen.rb ruby/test_frozen_error.rb ruby/test_gc.rb ruby/test_hash.rb ruby/test_ifunless.rb ruby/test_inlinecache.rb ruby/test_integer.rb ruby/test_integer_comb.rb ruby/test_io.rb ruby/test_io_buffer.rb ruby/test_io_m17n.rb ruby/test_io_timeout.rb ruby/test_iterator.rb ruby/test_key_error.rb ruby/test_keyword.rb ruby/test_lambda.rb ruby/test_lazy_enumerator.rb ruby/test_literal.rb ruby/test_m17n.rb ruby/test_m17n_comb.rb ruby/test_marshal.rb ruby/test_math.rb ruby/test_metaclass.rb ruby/test_method.rb ruby/test_method_cache.rb ruby/test_mixed_unicode_escapes.rb ruby/test_module.rb ruby/test_name_error.rb ruby/test_nomethod_error.rb ruby/test_not.rb ruby/test_numeric.rb ruby/test_object.rb ruby/test_optimization.rb ruby/test_pack.rb ruby/test_parse.rb ruby/test_path.rb ruby/test_pattern_matching.rb ruby/test_pipe.rb ruby/test_primitive.rb ruby/test_proc.rb ruby/test_rand.rb ruby/test_random_formatter.rb ruby/test_range.rb ruby/test_rational.rb ruby/test_rational2.rb ruby/test_readpartial.rb ruby/test_refinement.rb ruby/test_regexp.rb ruby/test_require.rb ruby/test_rubyoptions.rb ruby/test_sleep.rb ruby/test_sprintf.rb ruby/test_sprintf_comb.rb ruby/test_stack.rb ruby/test_string.rb ruby/test_stringchar.rb ruby/test_struct.rb ruby/test_super.rb ruby/test_symbol.rb ruby/test_system.rb ruby/test_thread.rb ruby/test_thread_cv.rb ruby/test_thread_queue.rb ruby/test_threadgroup.rb ruby/test_time.rb ruby/test_time_tz.rb ruby/test_trace.rb ruby/test_transcode.rb ruby/test_undef.rb ruby/test_unicode_escape.rb ruby/test_variable.rb ruby/test_warning.rb ruby/test_weakkeymap.rb ruby/test_weakmap.rb ruby/test_whileuntil.rb]
/home/ilmar/Projects-hdd/Original/jruby/rakelib/test.rake:118:in 'block in <main>'
/usr/share/rvm/gems/ruby-3.3.5/gems/rake-13.2.1/exe/rake:27:in '<main>'
Tasks: TOP => test:mri => test:mri:core:int
(See full trace by running task with --trace)

Will try clean master to check it

@ngr-ilmarh
Copy link
Contributor Author

Well, clean tests (without my patch) showed the same picture. So i'm sure patch is not related

@headius
Copy link
Member

headius commented Jan 30, 2026

Ignoring rbs-3.9.2 because its extensions are not built. Try: gem pristine rbs --version 3.9.2
Ignoring rbs-3.4.0 because its extensions are not built. Try: gem pristine rbs --version 3.4.0

@ngr-ilmarh Are you sharing a gem home with CRuby? The rbs gem does not support JRuby and could not have been installed on JRuby, so I suspect you are using the same gem home for both JRuby and CRuby.

This may work ok but is not recommended, since some gems supported by CRuby will not work on JRuby (as shown by these warnings). The warnings may just be throwing of your test results.

As for the changes, I can't find no reason this parameter needs to be Integer instead of int, so this is probably fine to merge. I'm going to do a search to see if any third-party code uses this API with Integer.

@headius
Copy link
Member

headius commented Jan 30, 2026

The only references I could find were in other JRuby forks, so I think this is fine to merge. I'll let the CI tests run and then we can go forward with it.

@headius
Copy link
Member

headius commented Jan 30, 2026

I realized this was never re-targeted at the jruby-9.4 branch but I don't know if it matters.

@ngr-ilmarh
Copy link
Contributor Author

Yes, had ruby installed. And as i see there is date formating error in https://github.com/jruby/jruby/blob/master/test/mri/psych/visitors/test_yaml_tree.rb#L92. i'm sure this patch didn't affect it

@headius headius merged commit a2b7680 into jruby:master Jan 30, 2026
76 of 77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants