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-install-nginx-module is running after installation as a dynamic module #2517

Open
acortes-kz opened this issue Dec 26, 2023 · 8 comments

Comments

@acortes-kz
Copy link

acortes-kz commented Dec 26, 2023

Question 1: What is the problem?

I installed Passenger as a dynamic module as indicated in the documentation. The installation was successful, but then I started to notice that my server was running slowly. Upon checking with the htop command, I found this:

image

This process is consuming CPU and slowing down my server. Is this normal? Should I allocate more resources to my server?

I tried stopping my Nginx service with sudo service nginx stop, but this process continues running.

Question 2: Passenger version and integration mode:

Phusion Passenger(R) 6.0.19
Nginx/1.24.0

Question 3: OS or Linux distro, platform (including version):

Ubuntu 20.04.6 LTS

Question 4: Passenger installation method:

Dynamic Nginx Module

Question 5: Your app's programming language (including any version managers) and framework (including versions):

Ruby 1.9.3
Rails 3.2.12
RVM1.29.12

@CamJN
Copy link
Contributor

CamJN commented Dec 26, 2023

It is a common mistake to run passenger start as well as starting Nginx, did you do that?

@acortes-kz
Copy link
Author

acortes-kz commented Dec 27, 2023

@CamJN No, I didn't run passenger start. I was starting Nginx with sudo service nginx start, and that was triggering Passenger. How could I stop that service? Is it necessary for that service to be running?

@CamJN
Copy link
Contributor

CamJN commented Dec 27, 2023

The passenger-install-nginx-module script isn't a service, and is not necessary to be running once Passenger is setup. The question is how it is being started, as it shouldn't be if I understand your setup correctly.

How are you installing the passenger dynamic module?

@acortes-kz
Copy link
Author

I installed Passenger as a dynamic module following this documentation. In summary, it involves downloading the Nginx code and recompiling it with the Passenger module. During this process, there were no issues. I added load_module modules/ngx_http_passenger_module.so; to my nginx.conf file. If my Nginx service is stopped, passenger-status doesn't show any information. However, when I start my Nginx service with sudo service nginx start and run passenger-status again, I can see information about my website. I believe that when I start Nginx, Passenger is initiated automatically. Is that correct?

But I see passenger-install-nginx-module running when I execute htop and that slows down my server.

@CamJN
Copy link
Contributor

CamJN commented Dec 27, 2023

You are correct that when you start Nginx, Passenger is initiated automatically. However it shouldn't be running the passenger-install-nginx-module script. In fact passenger does not run that script automatically in any (non-CI) situation I can think of. You can grep the codebase to confirm that. Perhaps you are using something like Capistrano which might run that script for you? Or it's in a Rakefile somewhere? Depending on the size of your server's disk contents I'd suggest grepping your app's files for mention of the script or the whole server if that could be achieved in a reasonable amount of time.

@acortes-kz
Copy link
Author

I use Capistrano to perform deployments in my project, but no Capistrano processes or tasks were executed; only the installation of Passenger as a dynamic module was carried out. I assume that at some point, the compilation process did not close properly and remained hanging. Should I kill the process?

However, in Capistrano, I have these tasks to start Passenger. I believe they wouldn't be necessary to run them in each deployment, right?

namespace :passenger do
  task :stop, :only => { :passenger => true }, :on_no_matching_servers => :continue do ; end
  task :start, :only => { :passenger => true }, :on_no_matching_servers => :continue do ; end
  task :restart, :roles => :app, :only => { :passenger => true }, :on_no_matching_servers => :continue do
    run "touch #{File.join(current_path,'tmp','restart.txt')}"
  end
end

@CamJN
Copy link
Contributor

CamJN commented Dec 28, 2023

Only the restart is necessary in each deployment. When you built the passenger dynamic nginx module, the passenger-install-nginx-module script shouldn't have been run, as it builds a statically linked nginx with passenger built in, plus the compilation is mostly handled by nginx's configure script and makefile. Perhaps check what the parent process is of the passenger-install-nginx-module script, or a few generations of parent processes? From what you've mentioned doing the script shouldn't have run at all, so it's really quite strange.

@acortes-kz
Copy link
Author

Indeed, this is quite strange. I have no idea what it could be; however, upon restarting my server, the process disappeared, and CPU consumption decreased.

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

2 participants