Skip to content

Cucumber / RSpec / TruffleRuby error in CI: ArgumentError: circular causes #3870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
luke-hill opened this issue May 16, 2025 · 3 comments
Open
Assignees

Comments

@luke-hill
Copy link

cf: https://github.com/cucumber/cucumber-ruby/actions/runs/15073041019/job/42373911130?pr=1782

I'm not 100% sure of the error because there's not much of a stacktrace. But quite simple tests which pass in all other rubies fail in Truffleruby for some reason.

In TruffleRuby head (2 months ago)

truffleruby 25.0.0-dev-d3120a20, like ruby 3.3.7, GraalVM CE Native [x86_64-linux]

These tests passed

In TruffleRuby today

truffleruby 25.0.0-dev-a65bde3d, like ruby 3.3.7, GraalVM CE Native [x86_64-linux]

These tests fail.

Tests in question are 3 that use the follow snippet style: allow(registry.current_world).to receive(:target) { target }

Any advice / next steps greatly appreciated

Luke - Cucumber Ruby Lead

@ankane
Copy link

ankane commented May 16, 2025

Was just about to report this as well. Here's a simple repro script:

begin
  begin
    raise "Error 1"
  rescue
    raise "Error 2"
  end
rescue => e
  raise e.cause
end

CRuby

repro.rb:3:in '<main>': Error 1 (RuntimeError)

truffleruby 25.0.0-dev-a65bde3d

<internal:core> core/kernel.rb:716:in `raise': circular causes (ArgumentError)
	from repro.rb:8:in `<main>'
repro.rb:5:in `<main>': Error 2 (RuntimeError)
repro.rb:3:in `<main>': Error 1 (RuntimeError)

@andrykonchin
Copy link
Member

Thank you for the report, we'll look into it.

@andrykonchin
Copy link
Member

It seems it's caused by #3857.

In the mentioned example

begin
  begin
    raise "Error 1"
  rescue
    raise "Error 2"
  end
rescue => e
  raise e.cause
end

the last #raise (that's raise e.cause) assigns a cause to the raised exception but CRuby by some reason doesn't do so. Added in #3857 check for circular causes detects a circle (as far as now we have a circle in the causes chain: "Error 1" -> "Error 2" -> "Error 1") and raises circular causes (ArgumentError).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants