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

passenger-memory-stats does not list jruby application processes #1878

Closed
bbergstrom opened this issue Oct 4, 2016 · 6 comments
Closed

passenger-memory-stats does not list jruby application processes #1878

bbergstrom opened this issue Oct 4, 2016 · 6 comments
Milestone

Comments

@bbergstrom
Copy link

Issue report

passenger-memory-stats is failing to report memory usage of the app/rails/rack processes when using JRuby. I believe this is because the matchers at https://github.com/phusion/passenger/blob/master/src/ruby_supportlib/phusion_passenger/admin_tools/memory_stats.rb#L93 do not find the java processes.

The java rails process look like this:

24026 22012   28 2872160 416528 1.5 /usr/java/jdk1.7.0_51/bin/java -Xmx500m -Xss2048k -Djffi.boot.library.path=/opt/jruby/jruby-1.7.13/lib/jni -Xbootclasspath/a:/opt/jruby/jruby-1.7.13/lib/jruby.jar -classpath : -Djruby.home=/opt/jruby/jruby-1.7.13 -Djruby.lib=/opt/jruby/jruby-1.7.13/lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main /opt/jruby/jruby-1.7.13/lib/ruby/gems/shared/gems/passenger-5.0.16/helper-scripts/rack-loader.rb

I believe if we update the expression to also match on rack-loader.rb it will resolve the issue.

For example, current expression match:

$ ps -A -w -o pid,ppid,nlwp,vsz,rss,%cpu,command |egrep '((^| )Passenger|(^| )Rails:|(^| )Rack:|wsgi-loader.py|(.*)PassengerAgent)'
 8244  8209    1 110456  2168  0.0 grep -E --color=auto ((^| )Passenger|(^| )Rails:|(^| )Rack:|wsgi-loader.py|(.*)PassengerAgent)
22009 20487    6 425492  8312  0.0 Passenger watchdog                                                      
22012 22009   38 2187756 11260 0.5 Passenger core                                                      
22021 22009    4 294152  8812  0.0 Passenger ust-router                       

New expression match:

$ ps -A -w -o pid,ppid,nlwp,vsz,rss,%cpu,command |egrep '((^| )Passenger|(^| )Rails:|(^| )Rack:|wsgi-loader.py|(.*)PassengerAgent|rack-loader.rb)'
 8248  8209    1 110456  2192  0.0 grep -E --color=auto ((^| )Passenger|(^| )Rails:|(^| )Rack:|wsgi-loader.py|(.*)PassengerAgent|rack-loader.rb)
22009 20487    6 425492  8312  0.0 Passenger watchdog                                                      
22012 22009   38 2187752 11260 0.5 Passenger core                                                      
22021 22009    4 294152  8812  0.0 Passenger ust-router                                                      
22187 22012   28 2872160 404404 0.4 /usr/java/jdk1.7.0_51/bin/java -Xmx500m -Xss2048k -Djffi.boot.library.path=/opt/jruby/jruby-1.7.13/lib/jni -Xbootclasspath/a:/opt/jruby/jruby-1.7.13/lib/jruby.jar -classpath : -Djruby.home=/opt/jruby/jruby-1.7.13 -Djruby.lib=/opt/jruby/jruby-1.7.13/lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main /opt/jruby/jruby-1.7.13/lib/ruby/gems/shared/gems/passenger-5.0.16/helper-scripts/rack-loader.rb
CamJN added a commit that referenced this issue Nov 4, 2016
…loses GH-1878.

Extends the regex that selects relevant proceses to also search for `rack_loader.rb`.
@CamJN
Copy link
Contributor

CamJN commented Nov 7, 2016

Normally that process renames itself to something like Passenger RubyApp: /path/to/app/public (development), do you have any ideas why this might be failing on your system? I'd like to reproduce the effect so I can test out the patch before landing it.

@bbergstrom
Copy link
Author

I do not know why the process is failing to rename itself. What is responsible for the proccess re-naming? AFAIK, we aren't doing anything custom to run it. Our Nginx config to wire Passenger to Jruby looks like this:

passenger_root /opt/jruby/jruby-1.7.13/lib/ruby/gems/shared/gems/passenger-5.0.16;
passenger_ruby /usr/local/bin/jruby;

We install JRuby using the tarball download from jruby.org. The applications config.ru is the standard one from Rails 3.

@OnixGH
Copy link
Contributor

OnixGH commented Nov 9, 2016

@bbergstrom Is it possible to try with 5.0.30?

@bbergstrom
Copy link
Author

It is still running on 5.0.16 and I'm not sure when we will get time to upgrade.

@CamJN
Copy link
Contributor

CamJN commented Nov 11, 2016

Are you launching passenger as an unprivileged user or root? Which OS and version are you using? Which JVM are you using?

@bbergstrom
Copy link
Author

Nginx is started by root. Nginx workers run under the nginx user. And passenger config has user switching to a deploy user:

passenger_root /opt/jruby/jruby-1.7.13/lib/ruby/gems/shared/gems/passenger-5.0.16;
passenger_ruby /usr/local/bin/jruby;
passenger_min_instances 4;
passenger_max_pool_size 4;
passenger_max_instances_per_app 0;
passenger_spawn_method direct;
passenger_pool_idle_time 0;
passenger_max_requests 0;

passenger_max_preloader_idle_time 0;
passenger_default_user deploy;
passenger_default_group nginx;
passenger_log_level 2;

passenger_buffers 8 16k;
passenger_buffer_size 32k;
passenger_user_switching on;
passenger_app_env staging;

OS: Amazon Linux (RHEL)

JVM

java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

CamJN added a commit that referenced this issue Nov 28, 2016
…loses GH-1878.

Extends the regex that selects relevant proceses to also search for `rack_loader.rb`.
CamJN added a commit that referenced this issue Dec 27, 2016
…loses GH-1878.

Extends the regex that selects relevant proceses to also search for `rack_loader.rb`.
CamJN added a commit that referenced this issue Jan 12, 2017
…loses GH-1878.

Extends the regex that selects relevant proceses to also search for `rack_loader.rb`.
@OnixGH OnixGH closed this as completed in 2d50937 Jan 24, 2017
@OnixGH OnixGH added this to the 5.1.2 milestone Jan 24, 2017
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

No branches or pull requests

4 participants