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

iodine issue: External LLVMFunction pthread_atfork cannot be found #3188

Closed
AlexeyMatskevich opened this issue Feb 6, 2021 · 6 comments
Closed
Assignees

Comments

@AlexeyMatskevich
Copy link

RuntimeError: External LLVMFunction pthread_atfork cannot be found.
  <internal:core> core/kernel.rb:293:in `require_relative'
  /home/aleksei/.asdf/installs/ruby/truffleruby+graalvm-20.3.0/graalvm/jre/languages/ruby/lib/gems/gems/iodine-0.7.43/lib/iodine.rb:6:in `<top (required)>'
  <internal:core> core/kernel.rb:234:in `gem_original_require'
  /home/aleksei/.asdf/installs/ruby/truffleruby+graalvm-20.3.0/graalvm/jre/languages/ruby/lib/gems/gems/iodine-0.7.43/exe/iodine:4:in `<top (required)>'
  <internal:core> core/kernel.rb:401:in `load'
  <internal:core> core/kernel.rb:401:in `load'
  /home/aleksei/.asdf/installs/ruby/truffleruby+graalvm-20.3.0/bin/iodine:23:in `<top (required)>'
  <internal:core> core/kernel.rb:401:in `load'
  <internal:core> core/kernel.rb:401:in `load'

[ [ SubstrateSegfaultHandler caught a segfault. ] ]

To reproduce:

gem install iodine
iodine
@eregon
Copy link
Member

eregon commented Feb 6, 2021

Thanks for the report.

I can reproduce.
This might be caused by not linking to libpthread, but actually it seems like it is linked to it:

$ gem i iodine

$ iodine --experimental-options --cexts-log-load --help
<internal:core> core/kernel.rb:293:in `require_relative': External LLVMFunction pthread_atfork cannot be found. (RuntimeError)
	from /home/eregon/.rubies/truffleruby-dev/lib/gems/gems/iodine-0.7.43/lib/iodine.rb:6:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/eregon/.rubies/truffleruby-dev/lib/mri/rubygems/core_ext/kernel_require.rb:72:in `require'
	from /home/eregon/.rubies/truffleruby-dev/lib/gems/gems/iodine-0.7.43/exe/iodine:4:in `<top (required)>'
	from <internal:core> core/kernel.rb:400:in `load'
	from <internal:core> core/kernel.rb:400:in `load'
	from /home/eregon/.rubies/truffleruby-dev/bin/iodine:23:in `<main>'

$  ldd /home/eregon/.rubies/truffleruby-dev/lib/gems/gems/iodine-0.7.43/lib/iodine/iodine.so
	linux-vdso.so.1 (0x00007ffcef965000)
	libtruffleruby.so => /home/eregon/.rubies/truffleruby-dev/lib/cext/libtruffleruby.so (0x00007fda8ad56000)
	libgraalvm-llvm.so.1 => /home/eregon/.rubies/truffleruby-dev/lib/sulong/native/lib/libgraalvm-llvm.so.1 (0x00007fda8ad49000)
	libssl.so.1.1 => /lib64/libssl.so.1.1 (0x00007fda8ac8e000)
	libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007fda8a9a1000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fda8a7d7000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fda8b0bf000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fda8a7b5000)
	libz.so.1 => /lib64/libz.so.1 (0x00007fda8a799000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007fda8a792000)

$ nm /lib64/libpthread.so.0 | grep pthread_atfork
0000000000011ba0 t .annobin___dyn_pthread_atfork.end
0000000000011b90 t .annobin___dyn_pthread_atfork.start
0000000000011b90 t .annobin_old_pthread_atfork.c
0000000000011ba0 t .annobin_old_pthread_atfork.c_end
0000000000007b15 t .annobin_old_pthread_atfork.c_end.exit
0000000000007b15 t .annobin_old_pthread_atfork.c_end.hot
0000000000007b15 t .annobin_old_pthread_atfork.c_end.startup
0000000000007b15 t .annobin_old_pthread_atfork.c_end.unlikely
0000000000007b15 t .annobin_old_pthread_atfork.c.exit
0000000000007b15 t .annobin_old_pthread_atfork.c.hot
0000000000007b15 t .annobin_old_pthread_atfork.c.startup
0000000000007b15 t .annobin_old_pthread_atfork.c.unlikely
0000000000011b90 t __dyn_pthread_atfork
0000000000011b90 T pthread_atfork@GLIBC_2.2.5

I think this is a Sulong or NFI issue, so I'll move the issue to oracle/graal.

@eregon eregon transferred this issue from oracle/truffleruby Feb 6, 2021
@oubidar-Abderrahim oubidar-Abderrahim self-assigned this Feb 8, 2021
@oubidar-Abderrahim
Copy link
Member

Could you please provide more detailed steps to reproduce this issue? that would be helpful

@AlexeyMatskevich
Copy link
Author

AlexeyMatskevich commented Feb 8, 2021

a) With rbenv

  1. Install rbenv
  2. Install truffleruby+graalvm-20.3.0 from ruby-build with rbenv install truffleruby+graalvm-20.3.0
  3. Switch to truffleruby with rbenv shell truffleruby+graalvm-20.3.0
  4. Check ruby version
ruby -v
truffleruby 20.3.0, like ruby 2.6.6, GraalVM CE Native [x86_64-linux]
  1. Install iodine with gem install iodine
  2. Run iodine with iodine or try to check iodine version with iodine -v

b) With docker

  1. Pull container with docker pull flavorjones/truffleruby:20.3.0-buster
  2. Connect to container with docker run -it --rm flavorjones/truffleruby:20.3.0-buster bash
  3. Install iodine with gem install iodine
  4. Run iodine with iodine or try to check iodine version with iodine -v
iodine -v
<internal:core> core/kernel.rb:293:in `require_relative': External LLVMFunction pthread_atfork cannot be found. (RuntimeError)
        from /home/alex/.rbenv/versions/truffleruby+graalvm-20.3.0/graalvm/jre/languages/ruby/lib/gems/gems/iodine-0.7.43/lib/iodine.rb:6:in `<top (required)>'
        from <internal:core> core/kernel.rb:234:in `gem_original_require'
        from /home/alex/.rbenv/versions/truffleruby+graalvm-20.3.0/graalvm/jre/languages/ruby/lib/mri/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /home/alex/.rbenv/versions/truffleruby+graalvm-20.3.0/graalvm/jre/languages/ruby/lib/gems/gems/iodine-0.7.43/exe/iodine:4:in `<top (required)>'
        from <internal:core> core/kernel.rb:401:in `load'
        from <internal:core> core/kernel.rb:401:in `load'
        from /home/alex/.rbenv/versions/truffleruby+graalvm-20.3.0/bin/iodine:23:in `<main>'

Get full backtrace

@oubidar-Abderrahim
Copy link
Member

The issue is tracked internally on GR-29336

@oubidar-Abderrahim
Copy link
Member

This is not planned

@oubidar-Abderrahim oubidar-Abderrahim closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2024
@eregon eregon added the ruby label Jan 16, 2024
@eregon
Copy link
Member

eregon commented Jan 16, 2024

The pthread_atfork stuff seems to work now since truffleruby runs extensions natively oracle/truffleruby#3118 on master.
But we get another error, because rb_get_argv() isn't implemented yet on TruffleRuby.

$ chruby truffleruby-dev
$ gem i iodine
$ iodine --experimental-options --cexts-log-load --help
/home/eregon/.rubies/truffleruby-dev/bin/ruby: symbol lookup error: /home/eregon/.rubies/truffleruby-dev/lib/gems/gems/iodine-0.7.57/lib/iodine/iodine_ext.so: undefined symbol: rb_get_argv

If you care about that, please file an issue at https://github.com/oracle/truffleruby/issues.

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