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

Phased restart & symlinks doesn't change destination folder? #3290

Open
nguyenngoc2505 opened this issue Dec 11, 2023 · 3 comments · May be fixed by #3295
Open

Phased restart & symlinks doesn't change destination folder? #3290

nguyenngoc2505 opened this issue Dec 11, 2023 · 3 comments · May be fixed by #3295

Comments

@nguyenngoc2505
Copy link

My puma config

directory "/home/prj/current"
rackup "/home/prj/current/config.ru"

environment "staging"
pidfile "/home/prj/shared/tmp/pids/puma.pid"

state_path "/home/prj/shared/tmp/pids/puma.state"
stdout_redirect '/home/prj/shared/log/puma_access.log', '/home/prj/shared/log/puma_error.log', true

bind 'unix:///home/prj/shared/tmp/sockets/puma.sock'

workers 2
max_threads_count = 16
min_threads_count = 1
threads min_threads_count, max_threads_count

prune_bundler

on_worker_boot do
  require "active_record"
  ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished
  ActiveRecord::Base.establish_connection
end

before_fork do
  ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
end

current symlink

lrwxrwxrwx 1 deploy deploy   38 Dec  7 12:22 current -> /home/prj/releases/20231207032212/

after pharsed-restart

cat /home/prj/current/tmp/pids/puma.state 
---
pid: 4475
running_from: "/home/prj/releases/20231206070847"

ps aux | grep puma
deploy      4475  0.0  1.1 105820 11392 ?        Ss   Dec06   0:05 puma 6.4.0 (unix:///home/prj/shared/tmp/sockets/puma.sock) [20231206070847]
deploy     22985  0.1 16.6 785688 162364 ?       Sl   12:42   0:04 puma: cluster worker 0: 4475 [20231206070847]
deploy     23001  0.1 22.7 812040 221384 ?       Sl   12:42   0:04 puma: cluster worker 1: 4475 [20231206070847]

ls /home/prj/releases/
20231206073136  20231206073247  20231207032212

its seem like puma still working on old release folder?

@dentarg
Copy link
Member

dentarg commented Dec 11, 2023

Looks like that yes, but is your new application code loaded or not? Please test

Docs says symlinks are evaluated, so if new code isn't being loaded, this is a regression, but it might be that the state isn't being reflected correctly (in that state file, in the worker process titles).

@nguyenngoc2505
Copy link
Author

nguyenngoc2505 commented Dec 11, 2023

@dentarg

Looks like that yes, but is your new application code loaded or not? Please test

it's seem like application run on newest. But how can I show the newest state of puma?
It's confusing, because I am not really knowing which release version the code will run

@dentarg
Copy link
Member

dentarg commented Dec 11, 2023

It's a bug in regards to the things I mentioned above. Please dive into the Puma code base and see if you can come up with a fix. This is not a support forum :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants