Skip to content
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

stackprof: rb_gc_latest_gc_info not implemented (RuntimeError) #1937

Closed
deepj opened this issue Feb 27, 2020 · 6 comments
Closed

stackprof: rb_gc_latest_gc_info not implemented (RuntimeError) #1937

deepj opened this issue Feb 27, 2020 · 6 comments
Assignees
Labels
Milestone

Comments

@deepj
Copy link

deepj commented Feb 27, 2020

To reproduce:

gem install stackprof
ruby -rstackprof

Error

ruby.c:2974:in `rb_tr_error': rb_gc_latest_gc_info not implemented (RuntimeError)
	from ruby.c:4086:in `rb_gc_latest_gc_info'
	from ~/.gem/truffleruby/2.6.5/gems/stackprof-0.2.15/ext/stackprof/stackprof.c:733:in `Init_stackprof'
	from ~/.rubies/truffleruby-dev/lib/mri/rubygems/core_ext/kernel_require.rb:54:in `require'
	from ~/.rubies/truffleruby-dev/lib/mri/rubygems/core_ext/kernel_require.rb:54:in `require'
	from ~/.gem/truffleruby/2.6.5/gems/stackprof-0.2.15/lib/stackprof.rb:1:in `<top (required)>'
	from ~/.rubies/truffleruby-dev/lib/mri/rubygems/core_ext/kernel_require.rb:130:in `require'
	from ~/.rubies/truffleruby-dev/lib/mri/rubygems/core_ext/kernel_require.rb:130:in `require'
	from ~/.rubies/truffleruby-dev/bin/irb:1:in `call'
	from ~/.rubies/truffleruby-dev/bin/irb:1:in `require'
	from ~/.rubies/truffleruby-dev/bin/irb:1:in `<main>'
@eregon eregon added the cexts label Feb 27, 2020
@eregon
Copy link
Member

eregon commented Feb 27, 2020

I'm not sure how realistic it is to try to run stackprof, it seems to use rb_profile_frames() for sampling.
We have a builtin --cpusampler that is likely always going to be far more efficient and should be a good replacement.

So I'd like to close this, because it doesn't seem worth the effort to support rb_profile_frames() if it's inefficient in the end anyway.

If you want a compatible API with StackProf then we could consider adding a TruffleRuby backend in that gem. Please open a separate issue if you want that.

@eregon eregon closed this as completed Feb 27, 2020
@deepj
Copy link
Author

deepj commented Feb 27, 2020

@eregon Hm, my point is more about not implemented rb_gc_latest_gc_info then about the gem itself.

@eregon
Copy link
Member

eregon commented Feb 27, 2020

Maybe we could stub that one (it seems to just return a Symbol), but using stackprof would fail anyway at runtime. I'd rather we focus on compatibility with gems we could run, stackprof seems rather unlikely to be useful to run on TruffleRuby as the overhead of profiling that way seems high.

@deepj
Copy link
Author

deepj commented Feb 28, 2020

@eregon If I'm not mistaken it's one of flamegraph gem's dependencies. That's why I guess tested this gem. Anyway, I still think it'd be worth to implement this method.

@eregon
Copy link
Member

eregon commented Feb 28, 2020

OK, implementing rb_gc_latest_gc_info(:state) as e.g. always returning :none seems easy:
https://github.com/ruby/ruby/blob/fbd7f08e922cdf1a4be7a71aa056659971c81dab/gc.c#L8862-L8863

I don't see it as a dependency in https://github.com/SamSaffron/flamegraph/blob/master/flamegraph.gemspec

@eregon eregon reopened this Feb 28, 2020
@bjfish bjfish self-assigned this Mar 2, 2020
@bjfish
Copy link
Contributor

bjfish commented Mar 3, 2020

This is now implemented at: 26bac34

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

No branches or pull requests

3 participants