@ledsun blog

無味の味は佳境に入らざればすなわち知れず

ruby.wasmのテストが失敗する

最近ruby.wasmのテストが失敗します。 ビルドはできてテストの実行時にエラーがおきます。 自分の環境だけかと思ったらGitHub Actionsでも失敗しています。 例えば Nightly release · ruby/ruby.wasm@8da2029 · GitHub です。

rake npm:ruby-head-wasm-wasi:checkを実行すると、次のエラーが起きます。

-- Control frame information -----------------------------------------------
c:0014 p:---- s:0071 e:000070 DUMMY  [FINISH]
c:0013 p:---- s:0068 e:000067 CFUNC  :require
c:0012 p:0023 s:0063 e:000062 METHOD <internal:/usr/local/lib/ruby/3.4.0+0/rubygems/core_ext/kernel_require.rb>:136
c:0011 p:0006 s:0057 e:000056 TOP    /bundle/gems/test-unit-3.6.2/lib/test/unit/collector/descendant.rb:1 [FINISH]
c:0010 p:---- s:0054 e:000053 CFUNC  :require
c:0009 p:0023 s:0049 e:000048 METHOD <internal:/usr/local/lib/ruby/3.4.0+0/rubygems/core_ext/kernel_require.rb>:136
c:0008 p:0006 s:0043 e:000042 BLOCK  /bundle/gems/test-unit-3.6.2/lib/test/unit/autorunner.rb:88
c:0007 p:0017 s:0038 e:000037 METHOD /bundle/gems/test-unit-3.6.2/lib/test/unit/autorunner.rb:454
c:0006 p:0057 s:0032 e:000031 METHOD /bundle/gems/test-unit-3.6.2/lib/test/unit/autorunner.rb:66
c:0005 p:0016 s:0023 E:0011ec EVAL   eval_async:4 [FINISH]
c:0004 p:---- s:0019 e:000018 CFUNC  :eval
c:0003 p:0014 s:0012 e:000010 BLOCK  /bundle/gems/js-2.6.2.dev/lib/js.rb:109
c:0002 p:0008 s:0008 e:000006 BLOCK  /bundle/gems/js-2.6.2.dev/lib/js.rb:120 [FINISH]
c:0001 p:---- s:0003 e:000002 DUMMY  [FINISH]

-- Ruby level backtrace information ----------------------------------------
/bundle/gems/js-2.6.2.dev/lib/js.rb:120:in 'block in __async'
/bundle/gems/js-2.6.2.dev/lib/js.rb:109:in 'block in __eval_async_rb'
/bundle/gems/js-2.6.2.dev/lib/js.rb:109:in 'eval'
eval_async:4:in '<compiled>'
/bundle/gems/test-unit-3.6.2/lib/test/unit/autorunner.rb:66:in 'run'
/bundle/gems/test-unit-3.6.2/lib/test/unit/autorunner.rb:454:in 'run'
/bundle/gems/test-unit-3.6.2/lib/test/unit/autorunner.rb:88:in 'block in <class:AutoRunner>'
<internal:/usr/local/lib/ruby/3.4.0+0/rubygems/core_ext/kernel_require.rb>:136:in 'require'
<internal:/usr/local/lib/ruby/3.4.0+0/rubygems/core_ext/kernel_require.rb>:136:in 'require'
/bundle/gems/test-unit-3.6.2/lib/test/unit/collector/descendant.rb:1:in '<top (required)>'
<internal:/usr/local/lib/ruby/3.4.0+0/rubygems/core_ext/kernel_require.rb>:136:in 'require'
<internal:/usr/local/lib/ruby/3.4.0+0/rubygems/core_ext/kernel_require.rb>:136:in 'require'

-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1

-- Other runtime information -----------------------------------------------

* Loaded script: -e

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 fiber.so
    3 rational.so
    4 complex.so
    5 ruby2_keywords.rb
    6 encdb.so
    7 trans/transdb.so
    8 /usr/local/lib/ruby/3.4.0+0/wasm32-wasi/rbconfig.rb
    9 /usr/local/lib/ruby/3.4.0+0/rubygems/compatibility.rb
   10 /usr/local/lib/ruby/3.4.0+0/rubygems/defaults.rb
   11 /usr/local/lib/ruby/3.4.0+0/rubygems/deprecate.rb
   12 /usr/local/lib/ruby/3.4.0+0/rubygems/errors.rb
   13 /usr/local/lib/ruby/3.4.0+0/rubygems/target_rbconfig.rb
   14 /usr/local/lib/ruby/3.4.0+0/rubygems/unknown_command_spell_checker.rb
   15 /usr/local/lib/ruby/3.4.0+0/rubygems/exceptions.rb
   16 /usr/local/lib/ruby/3.4.0+0/rubygems/basic_specification.rb
   17 /usr/local/lib/ruby/3.4.0+0/rubygems/stub_specification.rb
   18 /usr/local/lib/ruby/3.4.0+0/rubygems/platform.rb
   19 /usr/local/lib/ruby/3.4.0+0/rubygems/specification_record.rb
   20 /usr/local/lib/ruby/3.4.0+0/rubygems/util/list.rb
   21 /usr/local/lib/ruby/3.4.0+0/rubygems/version.rb
   22 /usr/local/lib/ruby/3.4.0+0/rubygems/requirement.rb
   23 /usr/local/lib/ruby/3.4.0+0/rubygems/specification.rb
   24 /usr/local/lib/ruby/3.4.0+0/rubygems/util.rb
   25 /usr/local/lib/ruby/3.4.0+0/rubygems/dependency.rb
   26 /usr/local/lib/ruby/3.4.0+0/rubygems/core_ext/kernel_gem.rb
   27 monitor.so
   28 /usr/local/lib/ruby/3.4.0+0/monitor.rb
   29 /usr/local/lib/ruby/3.4.0+0/rubygems.rb
   30 /usr/local/lib/ruby/3.4.0+0/bundled_gems.rb
   31 /usr/local/lib/ruby/3.4.0+0/rubygems/path_support.rb
   32 /usr/local/lib/ruby/3.4.0+0/error_highlight/version.rb
   33 /usr/local/lib/ruby/3.4.0+0/error_highlight/base.rb
   34 /usr/local/lib/ruby/3.4.0+0/error_highlight/formatter.rb
   35 /usr/local/lib/ruby/3.4.0+0/error_highlight/core_ext.rb
   36 /usr/local/lib/ruby/3.4.0+0/error_highlight.rb
   37 /usr/local/lib/ruby/3.4.0+0/did_you_mean/version.rb
   38 /usr/local/lib/ruby/3.4.0+0/did_you_mean/core_ext/name_error.rb
   39 /usr/local/lib/ruby/3.4.0+0/did_you_mean/levenshtein.rb
   40 /usr/local/lib/ruby/3.4.0+0/did_you_mean/jaro_winkler.rb
   41 /usr/local/lib/ruby/3.4.0+0/did_you_mean/spell_checker.rb
   42 /usr/local/lib/ruby/3.4.0+0/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb
   43 /usr/local/lib/ruby/3.4.0+0/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
   44 /usr/local/lib/ruby/3.4.0+0/did_you_mean/spell_checkers/name_error_checkers.rb
   45 /usr/local/lib/ruby/3.4.0+0/did_you_mean/spell_checkers/method_name_checker.rb
   46 /usr/local/lib/ruby/3.4.0+0/did_you_mean/spell_checkers/key_error_checker.rb
   47 /usr/local/lib/ruby/3.4.0+0/did_you_mean/spell_checkers/null_checker.rb
   48 /usr/local/lib/ruby/3.4.0+0/did_you_mean/tree_spell_checker.rb
   49 /usr/local/lib/ruby/3.4.0+0/did_you_mean/spell_checkers/require_path_checker.rb
   50 /usr/local/lib/ruby/3.4.0+0/did_you_mean/spell_checkers/pattern_key_name_checker.rb
   51 /usr/local/lib/ruby/3.4.0+0/did_you_mean/formatter.rb
   52 /usr/local/lib/ruby/3.4.0+0/did_you_mean.rb
   53 /usr/local/lib/ruby/3.4.0+0/syntax_suggest/core_ext.rb
   54 /bundle/setup.rb
   55 js.so
   56 /bundle/gems/js-2.6.2.dev/lib/js/hash.rb
   57 /bundle/gems/js-2.6.2.dev/lib/js/array.rb
   58 /bundle/gems/js-2.6.2.dev/lib/js/nil_class.rb
   59 /bundle/gems/js-2.6.2.dev/lib/js.rb
   60 /bundle/gems/test-unit-3.6.2/lib/test/unit/warning.rb
   61 /bundle/gems/test-unit-3.6.2/lib/test/unit/attribute.rb
   62 /bundle/gems/test-unit-3.6.2/lib/test/unit/fixture.rb
   63 /bundle/gems/test-unit-3.6.2/lib/test/unit/exception-handler.rb
   64 /bundle/gems/test-unit-3.6.2/lib/test/unit/assertion-failed-error.rb
   65 /bundle/gems/power_assert-2.0.3/lib/power_assert/configuration.rb
   66 /bundle/gems/power_assert-2.0.3/lib/power_assert/enable_tracepoint_events.rb
   67 /bundle/gems/power_assert-2.0.3/lib/power_assert/inspector.rb
   68 ripper.so
   69 /usr/local/lib/ruby/3.4.0+0/ripper/core.rb
   70 /usr/local/lib/ruby/3.4.0+0/ripper/lexer.rb
   71 /usr/local/lib/ruby/3.4.0+0/ripper/filter.rb
   72 /usr/local/lib/ruby/3.4.0+0/ripper/sexp.rb
   73 /usr/local/lib/ruby/3.4.0+0/ripper.rb
   74 /bundle/gems/power_assert-2.0.3/lib/power_assert/parser.rb
   75 /bundle/gems/power_assert-2.0.3/lib/power_assert/context.rb
   76 /bundle/gems/power_assert-2.0.3/lib/power_assert/version.rb
   77 /bundle/gems/power_assert-2.0.3/lib/power_assert.rb
   78 /bundle/gems/test-unit-3.6.2/lib/test/unit/util/backtracefilter.rb
   79 /bundle/gems/test-unit-3.6.2/lib/test/unit/util/memory-usage.rb
   80 /bundle/gems/test-unit-3.6.2/lib/test/unit/util/method-owner-finder.rb
   81 /bundle/gems/test-unit-3.6.2/lib/test/unit/diff.rb
   82 /bundle/gems/test-unit-3.6.2/lib/test/unit/assertions.rb
   83 /bundle/gems/test-unit-3.6.2/lib/test/unit/failure.rb
   84 /bundle/gems/test-unit-3.6.2/lib/test/unit/error.rb
   85 /bundle/gems/test-unit-3.6.2/lib/test/unit/pending.rb
   86 /bundle/gems/test-unit-3.6.2/lib/test/unit/omission.rb
   87 /bundle/gems/test-unit-3.6.2/lib/test/unit/notification.rb
   88 /bundle/gems/test-unit-3.6.2/lib/test/unit/priority.rb
   89 /bundle/gems/test-unit-3.6.2/lib/test/unit/data-sets.rb
   90 /bundle/gems/test-unit-3.6.2/lib/test/unit/data.rb
   91 /bundle/gems/test-unit-3.6.2/lib/test/unit/testsuite.rb
   92 /bundle/gems/test-unit-3.6.2/lib/test/unit/test-suite-creator.rb
   93 /bundle/gems/test-unit-3.6.2/lib/test/unit/auto-runner-loader.rb
   94 /bundle/gems/test-unit-3.6.2/lib/test/unit/util/output.rb
   95 /bundle/gems/test-unit-3.6.2/lib/test/unit/testcase.rb
   96 /usr/local/lib/ruby/3.4.0+0/English.rb
   97 /usr/local/lib/ruby/3.4.0+0/optparse.rb
   98 /bundle/gems/test-unit-3.6.2/lib/test/unit/color.rb
   99 /bundle/gems/test-unit-3.6.2/lib/test/unit/color-scheme.rb
  100 /bundle/gems/test-unit-3.6.2/lib/test/unit/attribute-matcher.rb
  101 /bundle/gems/test-unit-3.6.2/lib/test/unit/runner/console.rb
  102 /bundle/gems/test-unit-3.6.2/lib/test/unit/runner/emacs.rb
  103 /bundle/gems/test-unit-3.6.2/lib/test/unit/runner/xml.rb
  104 /bundle/gems/test-unit-3.6.2/lib/test/unit/autorunner.rb
  105 /bundle/gems/test-unit-3.6.2/lib/test/unit.rb
  106 /bundle/gems/test-unit-3.6.2/lib/test-unit.rb
  107 /__root__/test/unit/test_js.rb
  108 /__root__/test/unit/test_object.rb
  109 /__root__/test/unit/test_object_wrap.rb
  110 /__root__/test/unit/test_error.rb
  111 /__root__/test/unit/test_async.rb
  112 /__root__/test/unit/test_float.rb
  113 /__root__/test/unit/test_proc.rb
  114 /__root__/test/unit/test_array.rb
  115 /__root__/test/unit/test_hash.rb
  116 /__root__/test/unit/test_nil_class.rb
  117 /usr/local/lib/ruby/3.4.0+0/singleton.rb
  118 /bundle/gems/js-2.6.2.dev/lib/js/require_remote/url_resolver.rb
  119 /bundle/gems/js-2.6.2.dev/lib/js/require_remote/evaluator.rb
  120 /bundle/gems/js-2.6.2.dev/lib/js/require_remote.rb
  121 /__root__/test/unit/require_remote/url_resolver.rb
  122 /__root__/test/test_unit.rb
  123 /bundle/gems/test-unit-3.6.2/lib/test/unit/ui/console/outputlevel.rb

wasm://wasm/0ba08026:1


RangeError: Maximum call stack size exceeded
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x37cbf4)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x37d6a9)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x38e034)
    at pm_compile_scope_node (wasm://wasm/0ba08026:wasm-function[4969]:0x3b350c)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x38d579)
    at pm_iseq_compile_node (wasm://wasm/0ba08026:wasm-function[4911]:0x37cb18)
    at pm_iseq_new_with_opt (wasm://wasm/0ba08026:wasm-function[5154]:0x404880)
    at pm_compile_call (wasm://wasm/0ba08026:wasm-function[4973]:0x3b7588)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x38f8d2)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x388672)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x38dfce)
    at pm_compile_scope_node (wasm://wasm/0ba08026:wasm-function[4969]:0x3b3dd3)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x38d579)
    at pm_iseq_compile_node (wasm://wasm/0ba08026:wasm-function[4911]:0x37cb18)
    at pm_iseq_new_with_opt (wasm://wasm/0ba08026:wasm-function[5154]:0x404880)
    at pm_new_child_iseq (wasm://wasm/0ba08026:wasm-function[4938]:0x3a2b0a)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x3829f7)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x38dfce)
    at pm_compile_scope_node (wasm://wasm/0ba08026:wasm-function[4969]:0x3b492f)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x38d579)
    at pm_iseq_compile_node (wasm://wasm/0ba08026:wasm-function[4911]:0x37cb18)
    at pm_iseq_new_with_opt (wasm://wasm/0ba08026:wasm-function[5154]:0x404880)
    at pm_new_child_iseq (wasm://wasm/0ba08026:wasm-function[4938]:0x3a2b0a)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x389f21)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x38e034)
    at pm_compile_scope_node (wasm://wasm/0ba08026:wasm-function[4969]:0x3b492f)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x38d579)
    at pm_iseq_compile_node (wasm://wasm/0ba08026:wasm-function[4911]:0x37cb18)
    at pm_iseq_new_with_opt (wasm://wasm/0ba08026:wasm-function[5154]:0x404880)
    at pm_new_child_iseq (wasm://wasm/0ba08026:wasm-function[4938]:0x3a2b0a)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x389f21)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x38e034)
    at pm_compile_scope_node (wasm://wasm/0ba08026:wasm-function[4969]:0x3b492f)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x38d579)
    at pm_iseq_compile_node (wasm://wasm/0ba08026:wasm-function[4911]:0x37cb18)
    at pm_iseq_new_with_opt (wasm://wasm/0ba08026:wasm-function[5154]:0x404880)
    at pm_new_child_iseq (wasm://wasm/0ba08026:wasm-function[4938]:0x3a2b0a)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x389f21)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x38e034)
    at pm_compile_scope_node (wasm://wasm/0ba08026:wasm-function[4969]:0x3b492f)
    at pm_compile_node (wasm://wasm/0ba08026:wasm-function[4912]:0x38d579)
    at pm_iseq_compile_node (wasm://wasm/0ba08026:wasm-function[4911]:0x37ca89)
    at pm_iseq_new_with_opt (wasm://wasm/0ba08026:wasm-function[5154]:0x404880)
    at pm_iseq_new_top (wasm://wasm/0ba08026:wasm-function[5153]:0x4045b3)
    at load_iseq_eval (wasm://wasm/0ba08026:wasm-function[5249]:0x419302)
    at require_internal (wasm://wasm/0ba08026:wasm-function[5253]:0x41a8d4)
    at rb_require_string (wasm://wasm/0ba08026:wasm-function[5252]:0x4199d2)
    at rb_f_require (wasm://wasm/0ba08026:wasm-function[5251]:0x41988e)
    at ractor_safe_call_cfunc_1 (wasm://wasm/0ba08026:wasm-function[8720]:0x6b16d4)
    at vm_call_cfunc_with_frame_ (wasm://wasm/0ba08026:wasm-function[8678]:0x6ac453)
    at vm_call_cfunc_other (wasm://wasm/0ba08026:wasm-function[8623]:0x6a3174)
    at vm_call_cfunc (wasm://wasm/0ba08026:wasm-function[8606]:0x69f11d)
    at vm_call_method_each_type (wasm://wasm/0ba08026:wasm-function[8602]:0x69d3bb)
    at vm_call_alias (wasm://wasm/0ba08026:wasm-function[8617]:0x6a1766)
    at vm_exec_core (wasm://wasm/0ba08026:wasm-function[8312]:0x676769)
    at vm_exec_bottom_main (wasm://wasm/0ba08026:wasm-function[8301]:0x669ef2)
    at rb_wasm_try_catch_loop_run (wasm://wasm/0ba08026:wasm-function[9626]:0x78169a)
    at rb_vm_exec (wasm://wasm/0ba08026:wasm-function[8286]:0x667ba8)
    at rb_iseq_eval (wasm://wasm/0ba08026:wasm-function[8546]:0x6967d8)
    at load_iseq_eval (wasm://wasm/0ba08026:wasm-function[5249]:0x419662)
    at require_internal (wasm://wasm/0ba08026:wasm-function[5253]:0x41a8d4)
    at rb_require_string (wasm://wasm/0ba08026:wasm-function[5252]:0x4199d2)
    at rb_f_require (wasm://wasm/0ba08026:wasm-function[5251]:0x41988e)
    at ractor_safe_call_cfunc_1 (wasm://wasm/0ba08026:wasm-function[8720]:0x6b16d4)
    at vm_call_cfunc_with_frame_ (wasm://wasm/0ba08026:wasm-function[8678]:0x6ac453)
    at vm_call_cfunc_other (wasm://wasm/0ba08026:wasm-function[8623]:0x6a3174)
    at vm_call_cfunc (wasm://wasm/0ba08026:wasm-function[8606]:0x69f11d)
    at vm_call_method_each_type (wasm://wasm/0ba08026:wasm-function[8602]:0x69d3bb)
    at vm_call_method_each_type (wasm://wasm/0ba08026:wasm-function[8602]:0x69e542)
    at vm_call_method (wasm://wasm/0ba08026:wasm-function[8276]:0x665525)
    at vm_call_general (wasm://wasm/0ba08026:wasm-function[8266]:0x663b52)
    at vm_exec_core (wasm://wasm/0ba08026:wasm-function[8312]:0x676769)
    at vm_exec_loop (wasm://wasm/0ba08026:wasm-function[8545]:0x696359)
    at vm_exec_bottom_rescue (wasm://wasm/0ba08026:wasm-function[8302]:0x66a09e)
    at rb_wasm_try_catch_loop_run (wasm://wasm/0ba08026:wasm-function[9626]:0x78169a)
    at rb_vm_exec (wasm://wasm/0ba08026:wasm-function[8286]:0x667ba8)
    at rb_f_eval (wasm://wasm/0ba08026:wasm-function[8462]:0x689f95)
    at ractor_safe_call_cfunc_m1 (wasm://wasm/0ba08026:wasm-function[8345]:0x67b051)
    at vm_call_cfunc_with_frame_ (wasm://wasm/0ba08026:wasm-function[8678]:0x6ac453)
    at vm_call_cfunc_other (wasm://wasm/0ba08026:wasm-function[8623]:0x6a3174)
    at vm_call_cfunc (wasm://wasm/0ba08026:wasm-function[8606]:0x69f11d)
    at vm_call_method_each_type (wasm://wasm/0ba08026:wasm-function[8602]:0x69d3bb)
    at vm_call_method (wasm://wasm/0ba08026:wasm-function[8276]:0x6652cb)
    at vm_call_general (wasm://wasm/0ba08026:wasm-function[8266]:0x663b52)
    at vm_exec_core (wasm://wasm/0ba08026:wasm-function[8312]:0x676769)
    at vm_exec_bottom_main (wasm://wasm/0ba08026:wasm-function[8301]:0x669ef2)
    at rb_wasm_try_catch_loop_run (wasm://wasm/0ba08026:wasm-function[9626]:0x78169a)
    at rb_vm_exec (wasm://wasm/0ba08026:wasm-function[8286]:0x667ba8)
    at vm_invoke_proc (wasm://wasm/0ba08026:wasm-function[8523]:0x6932ca)
    at rb_vm_invoke_proc (wasm://wasm/0ba08026:wasm-function[8521]:0x6924c8)
    at rb_fiber_start (wasm://wasm/0ba08026:wasm-function[2987]:0x23a19a)
    at fiber_entry (wasm://wasm/0ba08026:wasm-function[2998]:0x23c05c)
    at coroutine_trampoline (wasm://wasm/0ba08026:wasm-function[9565]:0x77ca49)
    at rb_abi_guest_rb_funcallv_protect (wasm://wasm/0ba08026:wasm-function[108]:0xe806)
    at __wasm_export_rb_abi_guest_rb_funcallv_protect (wasm://wasm/0ba08026:wasm-function[150]:0xfaa6)
    at LegacyBinding.rbFuncallvProtect (file:///home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi/dist/esm/bindgen/legacy/rb-abi-guest.js:91:171)
    at exports.<computed> [as rbFuncallvProtect] (file:///home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi/dist/esm/vm.js:148:44)
    at file:///home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi/dist/esm/vm.js:773:42
    at wrapRbOperation (file:///home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi/dist/esm/vm.js:746:16)
    at callRbMethod (file:///home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi/dist/esm/vm.js:772:12)
    at RbValue.call (file:///home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi/dist/esm/vm.js:555:28)
    at file:///home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi/dist/esm/vm.js:460:16
    at file:///home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi/dist/esm/vm.js:794:9
    at new Promise (<anonymous>)
    at newRbPromise (file:///home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi/dist/esm/vm.js:786:12)
    at RubyVM.evalAsync (file:///home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi/dist/esm/vm.js:459:16)
    at test (file:///home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi/tools/run-test-unit.mjs:171:12)
    at async main (file:///home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi/tools/run-test-unit.mjs:184:5)

Node.js v18.18.2
npm ERR! Lifecycle script `test:unit` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: @ruby/wasm-wasi@2.6.2
npm ERR!   at location: /home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi
npm ERR! Lifecycle script `test` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: @ruby/head-wasm-wasi@2.6.2
npm ERR!   at location: /home/ledsun/ruby.wasm/packages/npm-packages/ruby-head-wasm-wasi
rake aborted!
Command failed with status (1): [npm test]
/home/ledsun/ruby.wasm/rakelib/packaging.rake:144:in `block (4 levels) in <top (required)>'
Tasks: TOP => npm:ruby-head-wasm-wasi:check
(See full trace by running task with --trace)

テストが失敗したり、Rubyスクリプトが例外を起こしたりするわけではありません。 RubyVMがエラーで落ちています。 エラーの読み方がわかりません。

わかる範囲でメッセージを拾い読みしてみます。

RangeError: Maximum call stack size exceeded

コールスタックが枯渇しています。 想定を超える回数の再帰呼び出しが起きているようです。

    at ruby.pm_compile_node (wasm://wasm/ruby-05380122:wasm-function[2795]:0x215877)
    at ruby.pm_compile_node (wasm://wasm/ruby-05380122:wasm-function[2795]:0x21fb6f)
    at ruby.pm_compile_node (wasm://wasm/ruby-05380122:wasm-function[2795]:0x227953)
    at ruby.pm_compile_scope_node (wasm://wasm/ruby-05380122:wasm-function[2852]:0x24f55a)

Rubyスクリプトをパースしてたノードのコンパイル処理が再帰しているようです。 なるほど「抽象構文木をたどるときに再帰する」はありそうです。

先週Ruby内部のデフォルトパーサーがPrismに変更されました。 Switch the default parser from parse.y to Prism by kddnewton · Pull Request #11497 · ruby/ruby · GitHub これが関係するのでしょうか? 当てずっぽうです。

パーサーを変えたら動きは変わるのでしょうか? テストの実行時オプションを指定してみます。

diff --git a/packages/npm-packages/ruby-wasm-wasi/tools/run-test-unit.mjs b/packages/npm-packages/ruby-wasm-wasi/tools/run-test-unit.mjs
index 70d8ec0..5fbda64 100755
--- a/packages/npm-packages/ruby-wasm-wasi/tools/run-test-unit.mjs
+++ b/packages/npm-packages/ruby-wasm-wasi/tools/run-test-unit.mjs
@@ -71,6 +71,7 @@ const instantiateNodeWasi = async (rootTestFile) => {

   const { vm } = await RubyVM.instantiateModule({
     module: rubyModule, wasip1: wasi,
+    args: ["ruby.wasm", "-EUTF-8", "-e_=0", '--parser=parse.y']
   })
   return { vm, wasi };
 };

途中まで動くようになりました。

npm test

> @ruby/head-wasm-wasi@2.6.2 test
> RUBY_NPM_PACKAGE_ROOT=../ruby-head-wasm-wasi npm -C ../ruby-wasm-wasi run test:run


> @ruby/wasm-wasi@2.6.2 test:run
> npm run test:unit && npm run test:vitest -- --run && npm run test:e2e


> @ruby/wasm-wasi@2.6.2 test:unit
> ./tools/run-test-unit.mjs

(node:112273) ExperimentalWarning: WASI is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Loaded suite -e
Started
Finished in 0.23249 seconds.
-------------------------------------------------------------------------------
64 tests, 217 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
-------------------------------------------------------------------------------
275.28 tests/s, 933.37 assertions/s
-- Control frame information -----------------------------------------------
c:0026 p:---- s:0122 e:000121 DUMMY  [FINISH]
c:0025 p:---- s:0119 e:000118 CFUNC  :require

本当にパーサー変更の影響がありそうです。