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

Add TruffleRuby to CI matrix #1751

Merged
merged 5 commits into from Jul 19, 2022
Merged

Conversation

dentarg
Copy link
Member

@dentarg dentarg commented Feb 16, 2022

No description provided.

@jkowens jkowens closed this Feb 21, 2022
@jkowens jkowens reopened this Feb 21, 2022
@jkowens jkowens changed the title Add JRuby and TruffleRuby to CI matrix Add TruffleRuby to CI matrix Feb 21, 2022
@dentarg dentarg marked this pull request as ready for review February 21, 2022 21:58
@dentarg
Copy link
Member Author

dentarg commented Feb 21, 2022

Maybe @eregon can take a look here? As it now works with MRI and JRuby

@olleolleolle
Copy link
Member

The Gemfile is sorta not installing very much for Truffle:

   Using rake 13.0.6
  Using bundler 2.2.22
  Using minitest 5.15.0
  Using multi_json 1.15.0
  Using ruby2_keywords 0.0.5
  Using mustermann 1.1.1
  Using rack 2.2.3
  Using rack-protection 3.0.0 from source at `rack-protection`
  Using rack-test 1.1.0
  Using tilt 2.0.10
  Using sinatra 3.0.0 from source at `.`
  Using sinatra-contrib 3.0.0 from source at `sinatra-contrib`
  Using unf_ext 0.0.8
  Using unf 0.1.4
  Using twitter-text 1.14.7
  Using webrick 1.7.0
  Using yard 0.9.27
  Bundle complete! 10 Gemfile dependencies, 17 gems now installed.
  Bundled gems are installed into `./vendor/bundle`
  Took  24.25 seconds

@epergo
Copy link
Member

epergo commented Feb 24, 2022

Probably because almost every gem is under RUBY_ENGINE == "ruby" https://github.com/sinatra/sinatra/blob/master/Gemfile#L29 We have to update it so dependencies are installed for truffle

@eregon
Copy link
Contributor

eregon commented Feb 24, 2022

Right that line should probably be unconditional.

FWIW, if RUBY_ENGINE in Gemfile is kind of an anti-pattern, gem 'foo', platforms: :ruby can be used to specify a gem which needs C extensions and is not installed on JRuby & on Windows: https://bundler.io/man/gemfile.5.html#PLATFORMS
And there is a block form: https://bundler.io/man/gemfile.5.html#BLOCK-FORM-OF-SOURCE-GIT-PATH-GROUP-and-PLATFORMS

Rubinius is dead AFAIK so that could probably be removed entirely from the Gemfile.

@olleolleolle
Copy link
Member

olleolleolle commented Feb 24, 2022

#1756 Thanks for the reminder, here is "drop rbx".

@olleolleolle
Copy link
Member

OK! #1757 is "use platforms:"!

@olleolleolle
Copy link
Member

(Gotta rebase, then we'll know more!)

@jkowens
Copy link
Member

jkowens commented Feb 24, 2022

@olleolleolle ah that's right. If I close/re-open the PR does that pick up the latest changes in master?

@olleolleolle
Copy link
Member

@olleolleolle ah that's right. If I close/re-open the PR does that pick up the latest changes in master?

@dentarg is probably awake enough to do that for us.

@eregon
Copy link
Contributor

eregon commented Feb 24, 2022

I commented on #1757 there are a few tweaks needed to let the gems install on TruffleRuby.

@eregon
Copy link
Contributor

eregon commented Feb 24, 2022

I (or maybe @bjfish) could take a shot e.g. tomorrow at making a PR changing whatever is needed (e.g., the Gemfile) to make the gems install correctly on truffleruby and the tests pass, that may be easier.

@olleolleolle
Copy link
Member

olleolleolle commented Feb 24, 2022

(Thanks, dentarg!)

/home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/tzinfo-1.2.9/lib/tzinfo/timezone.rb:653:in `const_missing': uninitialized constant ThreadSafe::Cache (NameError)

[To redirect Truffle log output to a file use one of the following options:
* '--log.file=<path>' if the option is passed using a guest language launcher.
* '-Dpolyglot.log.file=<path>' if the option is passed using the host Java launcher.
* Configure logging using the polyglot embedding API.]
[ruby] WARNING: Encoding.find('locale') is US-ASCII, this often indicates that the system locale is not set properly. Set LANG=C and LC_ALL=C to suppress this warning (but some things might break).
/home/runner/.rubies/truffleruby-22.0.0.2/lib/patches/thread_safe.rb:3: warning: loading in progress, circular require considered harmful - /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/thread_safe-0.3.6/lib/thread_safe.rb
/home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/tzinfo-1.2.9/lib/tzinfo/timezone.rb:653:in `const_missing': uninitialized constant ThreadSafe::Cache (NameError)
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/tzinfo-1.2.9/lib/tzinfo/timezone.rb:653:in `init_loaded_zones'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/tzinfo-1.2.9/lib/tzinfo/timezone.rb:655:in `<class:Timezone>'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/tzinfo-1.2.9/lib/tzinfo/timezone.rb:46:in `<module:TZInfo>'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/tzinfo-1.2.9/lib/tzinfo/timezone.rb:5:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/tzinfo-1.2.9/lib/tzinfo.rb:31:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/activesupport-5.1.7/lib/active_support/values/time_zone.rb:1:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/activesupport-5.1.7/lib/active_support/core_ext/time/conversions.rb:2:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/activesupport-5.1.7/lib/active_support/core_ext/time/calculations.rb:2:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/activesupport-5.1.7/lib/active_support/core_ext/time.rb:2:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/activesupport-5.1.7/lib/active_support/time.rb:10:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/activesupport-5.1.7/lib/active_support/core_ext/hash/conversions.rb:2:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/test/helper.rb:34:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/test/asciidoctor_test.rb:1:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:21:in `block in <main>'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:6:in `select'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:6:in `<main>'
rake aborted!
Command failed with status (1)
/home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
<internal:core> core/kernel.rb:376:in `load'
<internal:core> core/kernel.rb:376:in `load'
<internal:core> core/kernel.rb:376:in `load'
<internal:core> core/kernel.rb:376:in `load'
<internal:core> core/kernel.rb:376:in `load'
<internal:core> core/kernel.rb:376:in `load'
/home/runner/.rubies/truffleruby-22.0.0.2/bin/bundle:42:in `<main>'

Is this comment related to this? And the existence of a gems/thread_safe-0.3.6/lib/thread_safe.rb which may or may not be the same thing as the concurrent-ruby thing?

ruby-concurrency/thread_safe#23 (comment)

@olleolleolle
Copy link
Member

Perhaps #1758 will make more gems available to Truffleruby?

@eregon
Copy link
Contributor

eregon commented Feb 24, 2022

thread_safe is deprecated since a while and never had TruffleRuby suport, unlike concurrent-ruby which works fine.
It seems to be tzinfo 1.2.9 depending on it:

    tzinfo (1.2.9)
      thread_safe (~> 0.1)

Would it possible to update to a newer tzinfo which nowadays depends on concurrent-ruby? (https://github.com/tzinfo/tzinfo/blob/master/tzinfo.gemspec)

@olleolleolle
Copy link
Member

olleolleolle commented Feb 24, 2022

@eregon Ah, yes, the venerable

activesupport (5.1.7)
  concurrent-ruby (~> 1.0, >= 1.0.2)
  i18n (>= 0.7, < 2)
  minitest (~> 5.1)
  tzinfo (~> 1.1)

I will make that update in the "More careful Gemfile".

olleolleolle added a commit to olleolleolle/sinatra that referenced this pull request Feb 24, 2022
Try to get a tzinfo dependency which is dependent on concurrent-ruby, so
that good things happen, instead of

    /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/tzinfo-1.2.9/lib/tzinfo/timezone.rb:653:in `const_missing': uninitialized constant ThreadSafe::Cache (NameError)

For context, see:
sinatra#1751 (comment)
olleolleolle added a commit to olleolleolle/sinatra that referenced this pull request Feb 24, 2022
Try to get a tzinfo dependency which is dependent on concurrent-ruby, so
that good things happen, instead of

    /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/tzinfo-1.2.9/lib/tzinfo/timezone.rb:653:in `const_missing': uninitialized constant ThreadSafe::Cache (NameError)

For context, see:
sinatra#1751 (comment)
@olleolleolle
Copy link
Member

olleolleolle commented Feb 25, 2022

@eregon Now, we have arrived somewhere more interesting, I think. Here is a fragment:

/home/runner/.rubies/truffleruby-22.0.0.2/lib/patches/concurrent/atomic/atomic_reference.rb:8: warning: loading in progress, circular require considered harmful - gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb
gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/configuration.rb:89:in const_missing': uninitialized constant Concurrent::AtomicReference (NameError) from /gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/configuration.rb:89:in module:Concurrent'

/home/runner/.rubies/truffleruby-22.0.0.2/lib/patches/concurrent/atomic/atomic_reference.rb:8: warning: loading in progress, circular require considered harmful - /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb
/home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/configuration.rb:89:in `const_missing': uninitialized constant Concurrent::AtomicReference (NameError)
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/configuration.rb:89:in `<module:Concurrent>'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/configuration.rb:11:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent.rb:4:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/activesupport-6.1.4.6/lib/active_support/logger_thread_safe_level.rb:5:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/activesupport-6.1.4.6/lib/active_support/logger_silence.rb:5:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/activesupport-6.1.4.6/lib/active_support/logger.rb:3:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/activesupport-6.1.4.6/lib/active_support.rb:29:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/rabl-0.15.0/lib/rabl.rb:1:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/test/rabl_test.rb:4:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:21:in `block in <main>'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:6:in `select'
	from /home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:6:in `<main>'
rake aborted!
Command failed with status (1)

I note that perhaps this is related?
https://github.com/ruby-concurrency/concurrent-ruby/pull/907/files

@eregon
Copy link
Contributor

eregon commented Feb 25, 2022

I could repro it locally, also with latest TruffleRuby, I filed oracle/truffleruby#2605

@eregon
Copy link
Contributor

eregon commented Feb 25, 2022

BTW this warning:

[To redirect Truffle log output to a file use one of the following options:
* '--log.file=<path>' if the option is passed using a guest language launcher.
* '-Dpolyglot.log.file=<path>' if the option is passed using the host Java launcher.
* Configure logging using the polyglot embedding API.]
[ruby] WARNING: Encoding.find('locale') is US-ASCII, this often indicates that the system locale is not set properly. Set LANG=C and LC_ALL=C to suppress this warning (but some things might break).

is caused by:

sinatra/Rakefile

Lines 27 to 28 in 0309bbb

ENV['LANG'] = 'C'
ENV.delete 'LC_CTYPE'

It'd be great to remove that as that can break lots of things in very subtle ways (but doesn't seem the cause of the issue linked above).

olleolleolle added a commit to olleolleolle/sinatra that referenced this pull request Feb 25, 2022
olleolleolle added a commit to olleolleolle/sinatra that referenced this pull request Feb 25, 2022
@olleolleolle
Copy link
Member

@dentarg Right, now the warning-removing for Truffleruby is applied. Lots of keeping up, for this branch.

@olleolleolle
Copy link
Member

olleolleolle commented Mar 5, 2022

Speculating: Ah, is rainbows the gem, now not yet added with a platforms: including :ruby? Hm, no, that's the used setting:

https://github.com/sinatra/sinatra/blob/master/Gemfile#L32

loading
starting
/home/runner/work/sinatra/sinatra/vendor/bundle/truffleruby/3.0.2.22.0.0/gems/rack-2.2.3/lib/rack/handler.rb:45:in `pick': Couldn't find handler for: rainbows. (LoadError)
	from /home/runner/work/sinatra/sinatra/lib/sinatra/base.rb:1489:in `run!'
	from /home/runner/work/sinatra/sinatra/lib/sinatra/main.rb:45:in `block in <module:Sinatra>'

https://github.com/rack/rack/blob/main/lib/rack/handler.rb#L30-L42

@eregon
Copy link
Contributor

eregon commented Mar 6, 2022

I or @bjfish will take a look

@jkowens jkowens merged commit 98e5006 into sinatra:master Jul 19, 2022
@dentarg dentarg deleted the add-jvm-rubies-to-ci branch July 20, 2022 04:39
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.

None yet

5 participants