You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Passenger compiles passenger_native_support.so on demand when running with Ruby 2.7 under RVM with Passenger and Nginx installed separately from packages.
What is the actual behavior?
Your answer:
Passenger fails to compile passenger_native_support.so on demand:
App 57582 output: [passenger_native_support.so] trying to compile for the current user (www-data) and Ruby interpreter...
App 57582 output: (set PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable)
App 57582 output: Unable to autodetect the currently active RVM gem set name. This could happen if you ran this program using 'sudo' instead of 'rvmsudo'. When using RVM, you're always supposed to use 'rvmsudo' instead of 'sudo!'.
App 57582 output:
App 57582 output: Please try rerunning this program using 'rvmsudo'. If that doesn't help, please contact this program's author for support.
[ E 2022-04-27 18:11:19.8607 57508/Tk age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /var/www/arvados-api/current: The application process exited prematurely.
Error ID: 510aa8e0
Error details saved to: /tmp/passenger-error-AYAmYH.html
How can we reproduce it? Please try to provide a sample application (or Virtual Machine) demonstrating the issue. Otherwise, if we can't reproduce it, we might have to ask you a number of followup questions or run certain commands to try and figure out the problem.
Root cause of the problem:
rvm_ruby_string uses 3 strategies to figure out the gemset name:
1. Parsing $GEM_HOME
2. Parsing $GEM_PATH
3. Parsing $LOAD_PATH
By default, nginx removes all environment variables inherited from its parent process (except TZ), cf. http://nginx.org/en/docs/ngx_core_module.html#env. This means that the first two strategies won't work because neither $GEM_HOME or $GEM_PATH is defined out of the box.
On RVM 1.29.12 with Ruby 2.7.2, $LOAD_PATH looks like this for me:
Strategy 3 looks for the string rvm/gems/ which is not present in any of the items in $LOAD_PATH, so that doesn't work either.
Updating the check to also look for rvm/rubies/ fixes the detection for me, but I'm not sure that it is a correct solution:
diff --git a/src/ruby_supportlib/phusion_passenger/platform_info/ruby.rb b/src/ruby_supportlib/phusion_passenger/platform_info/ruby.rb
index 3a4fd8e88..2ec2e0bbf 100644
--- a/src/ruby_supportlib/phusion_passenger/platform_info/ruby.rb
+++ b/src/ruby_supportlib/phusion_passenger/platform_info/ruby.rb
@@ -309,10 +309,10 @@ def self.rvm_ruby_string
# That failed too. Try extracting info from from $LOAD_PATH.
matching_path = $LOAD_PATH.find_all do |item|
- item.include?("rvm/gems/")
+ item.include?("rvm/gems/") or item.include?("rvm/rubies/")
end
if matching_path && !matching_path.empty?
- subpath = matching_path.to_s.gsub(/^.*rvm\/gems\//, '')
+ subpath = matching_path.to_s.gsub(/^.*rvm\/(gems|rubies)\//, '')
result = subpath.split('/').first
return result if result
end
There is also a workaround:
Tell nginx to load GEM_HOME from the environment (i.e set env GEM_HOME in the main configuration context).
Update the startup script for Nginx to inject GEM_HOME from RVM in the environment when starting Nginx, e.g for systemd (in /etc/systemd/system/nginx.service.d/override.conf):
Question 2: Passenger version and integration mode:
Your answer:
open source passenger and libnginx-mod-http-passenger 6.0.13
Question 3: OS or Linux distro, platform (including version):
Your answer:
Debian 11, X86_64 or Ubuntu 18.04, X86_64 with RVM 1.29 (presumably all supported Debian/Ubuntu versions are affected)
Question 4: Passenger installation method:
Your answer:
[ ] RubyGems + Gemfile
[ ] RubyGems, no Gemfile
[ x] Phusion APT repo
[ ] Phusion YUM repo
[ ] OS X Homebrew
[ ] source tarball
[ ] Other, please specify:
Question 5: Your app's programming language (including any version managers) and framework (including versions):
Your answer:
RVM 1.29.12 with Ruby 2.7(.2)
Question 6: Are you using a PaaS and/or containerization? If so which one?
Your answer:
No.
Question 7: Anything else about your setup that we should know?
Your answer:
N/a
We strive for quality and appreciate you taking the time to submit a report! Please note that if you want guaranteed response times and priority issue support we encourage you to join our enterprise customer base. They also provide us with the means to continue our high level of open source support!
The text was updated successfully, but these errors were encountered:
Issue report
Question 1: What is the problem?
Your answer:
Passenger compiles passenger_native_support.so on demand when running with Ruby 2.7 under RVM with Passenger and Nginx installed separately from packages.
Your answer:
Passenger fails to compile passenger_native_support.so on demand:
Root cause of the problem:
rvm_ruby_string uses 3 strategies to figure out the gemset name:
1. Parsing $GEM_HOME
2. Parsing $GEM_PATH
3. Parsing $LOAD_PATH
By default, nginx removes all environment variables inherited from its parent process (except TZ), cf. http://nginx.org/en/docs/ngx_core_module.html#env. This means that the first two strategies won't work because neither $GEM_HOME or $GEM_PATH is defined out of the box.
On RVM 1.29.12 with Ruby 2.7.2, $LOAD_PATH looks like this for me:
["/usr/local/rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0", "/usr/local/rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/x86_64-linux", "/usr/local/rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby", "/usr/local/rvm/rubies/ruby-2.7.2/lib/ruby/vendor_ruby/2.7.0", "/usr/local/rvm/rubies/ruby-2.7.2/lib/ruby/vendor_ruby/2.7.0/x86_64-linux", "/usr/local/rvm/rubies/ruby-2.7.2/lib/ruby/vendor_ruby", "/usr/local/rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0", "/usr/local/rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/x86_64-linux"]
Strategy 3 looks for the string
rvm/gems/
which is not present in any of the items in $LOAD_PATH, so that doesn't work either.Updating the check to also look for
rvm/rubies/
fixes the detection for me, but I'm not sure that it is a correct solution:There is also a workaround:
env GEM_HOME
in themain
configuration context)./etc/systemd/system/nginx.service.d/override.conf
):Question 2: Passenger version and integration mode:
Your answer:
open source
passenger
andlibnginx-mod-http-passenger
6.0.13Question 3: OS or Linux distro, platform (including version):
Your answer:
Debian 11, X86_64 or Ubuntu 18.04, X86_64 with RVM 1.29 (presumably all supported Debian/Ubuntu versions are affected)
Question 4: Passenger installation method:
Your answer:
[ ] RubyGems + Gemfile
[ ] RubyGems, no Gemfile
[ x] Phusion APT repo
[ ] Phusion YUM repo
[ ] OS X Homebrew
[ ] source tarball
[ ] Other, please specify:
Question 5: Your app's programming language (including any version managers) and framework (including versions):
Your answer:
RVM 1.29.12 with Ruby 2.7(.2)
Question 6: Are you using a PaaS and/or containerization? If so which one?
Your answer:
No.
Question 7: Anything else about your setup that we should know?
Your answer:
N/a
We strive for quality and appreciate you taking the time to submit a report! Please note that if you want guaranteed response times and priority issue support we encourage you to join our enterprise customer base. They also provide us with the means to continue our high level of open source support!
The text was updated successfully, but these errors were encountered: