-
Notifications
You must be signed in to change notification settings - Fork 43
Closed
Labels
Description
Describe the bug
Hi there, I face some issues when I use puma in clustered mode (following the documentation in readme)
But I would list here a bit more issues:
- If I want multiple
clients
(multi-process app on a single machine - puma clustered mode for instance) - all processes have the same backup_file https://github.com/Unleash/unleash-client-ruby/blob/main/lib/unleash/configuration.rb#L47, only if you name application differently I can get separated backup_file so I won’t face withno such file or dir
error.
This error comes from there on File.rename. The only mechanism you use is Mutex, but it does not work for multiple processes (only for threads inside a single process) - second issue - https://github.com/Unleash/unleash-client-ruby/blob/c745ed4569b5e83498d22e0fbf618e8eb6ce2002/README.md#list-of-arguments
backup_file is overwritten [always](https://github.com/Unleash/unleash-client-ruby/blob/main/lib/unleash/client.rb#L15, https://github.com/Unleash/unleash-client-ruby/blob/main/lib/unleash/configuration.rb#L32), so I cannot define it explicitly. - another kinda issue - I need to control shutdown to avoid loss of data on my own, so the lib does not catch any termination signals.
we have puma in clustered mode on prod and in a single-mode in dev, which means I cannot use the same config on both ENVs according to the configuration section on the readme. - also would be great to have some prepared stubs for testing frameworks like RSpec.
Steps to reproduce the bug
system: MacOS BigSur 11.4
setup unleash according to the readme for puma (clustered mode) https://github.com/Unleash/unleash-client-ruby/blob/c745ed4569b5e83498d22e0fbf618e8eb6ce2002/README.md#with-preload_app
- initializer & puma.rb hook.
bundle exec puma -w 3 --preload
Expected behavior
No errors should be thrown.
Logs, error output, etc.
...
[2022-06-07T12:06:38.866649+02:00 Unleash ERROR] : Unable to save backup file. Exception thrown Errno::ENOENT:'No such file or directory @ rb_file_s_rename - (/var/folders/pf/_39szp0x68v6s0vrr0jfz9l80000gn/T/unlea
sh-oh-backend-repo.json.tmp, /var/folders/pf/_39szp0x68v6s0vrr0jfz9l80000gn/T/unleash-oh-backend-repo.json)'
[2022-06-07T12:06:38.867553+02:00 Unleash ERROR] : stacktrace: ["/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/unleash-4.2.1/lib/unleash/toggle_fetcher.rb:76:in `rename'", "/Users/viktorsych/.rb
env/versions/3.0.2/lib/ruby/gems/3.0.0/gems/unleash-4.2.1/lib/unleash/toggle_fetcher.rb:76:in `block in save!'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/unleash-4.2.1/lib/unleash/toggle_fetcher.rb
:72:in `synchronize'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/unleash-4.2.1/lib/unleash/toggle_fetcher.rb:72:in `save!'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/unleash
-4.2.1/lib/unleash/toggle_fetcher.rb:63:in `fetch'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/unleash-4.2.1/lib/unleash/toggle_fetcher.rb:22:in `initialize'", "/Users/viktorsych/.rbenv/versions/3.0
.2/lib/ruby/gems/3.0.0/gems/unleash-4.2.1/lib/unleash/client.rb:21:in `new'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/unleash-4.2.1/lib/unleash/client.rb:21:in `initialize'", "/Users/viktorsych/Co
de/oh/overhaul-backend/lib/unleash.rb:19:in `new'", "/Users/viktorsych/Code/oh/overhaul-backend/lib/unleash.rb:19:in `preload'", "config/puma.rb:56:in `block in _load_from'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ru
by/gems/3.0.0/gems/puma-5.6.4/lib/puma/configuration.rb:297:in `block in run_hooks'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/puma-5.6.4/lib/puma/configuration.rb:295:in `each'", "/Users/viktorsyc
h/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/puma-5.6.4/lib/puma/configuration.rb:295:in `run_hooks'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/puma-5.6.4/lib/puma/cluster/worker.rb:55:in `run'
", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/puma-5.6.4/lib/puma/cluster.rb:204:in `worker'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/puma-5.6.4/lib/puma/cluster.rb:97:in `
block in spawn_worker'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-6.1.5/lib/active_support/fork_tracker.rb:10:in `block in fork'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/ge
ms/3.0.0/gems/activesupport-6.1.5/lib/active_support/fork_tracker.rb:10:in `block in fork'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-6.1.5/lib/active_support/fork_tracker.rb:8:in `fo
rk'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-6.1.5/lib/active_support/fork_tracker.rb:8:in `fork'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-6
.1.5/lib/active_support/fork_tracker.rb:27:in `fork'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-6.1.5/lib/active_support/fork_tracker.rb:8:in `fork'", "/Users/viktorsych/.rbenv/versio
ns/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-6.1.5/lib/active_support/fork_tracker.rb:27:in `fork'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/puma-5.6.4/lib/puma/cluster.rb:97:in `spawn_worker'"
, "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/puma-5.6.4/lib/puma/cluster.rb:79:in `block in spawn_workers'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/puma-5.6.4/lib/puma/clus
ter.rb:72:in `times'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/puma-5.6.4/lib/puma/cluster.rb:72:in `spawn_workers'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/puma-5.6.4/l
ib/puma/cluster.rb:415:in `run'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/puma-5.6.4/lib/puma/launcher.rb:182:in `run'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/puma-5.6.
4/lib/puma/cli.rb:81:in `run'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/puma-5.6.4/bin/puma:10:in `<top (required)>'", "/Users/viktorsych/.rbenv/versions/3.0.2/bin/puma:23:in `load'", "/Users/vikt
orsych/.rbenv/versions/3.0.2/bin/puma:23:in `<top (required)>'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/lib/bundler/cli/exec.rb:58:in `load'", "/Users/viktorsych/.rbenv/versions/3.
0.2/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/lib/bundler/cli/exec.rb:58:in `kernel_load'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/lib/bundler/cli/exec.rb:23:in `run'", "/Users/vikto
rsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/lib/bundler/cli.rb:478:in `exec'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/lib/bundler/vendor/thor/lib/thor/comma
nd.rb:27:in `run'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/rub
y/gems/3.0.0/gems/bundler-2.2.32/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/lib/bundler/cli.rb:31:in `dispatch'", "/Users/viktor
sych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/lib/bundler/cli.
rb:25:in `start'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/exe/bundle:49:in `block in <top (required)>'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2
.2.32/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'", "/Users/viktorsych/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/exe/bundle:37:in `<top (required)>'", "/Users/viktorsych/.rbenv/versions
/3.0.2/bin/bundle:23:in `load'", "/Users/viktorsych/.rbenv/versions/3.0.2/bin/bundle:23:in `<main>'"]
Screenshots
No response
Additional context
No response
Unleash version
4.2.1
Subscription type
No response
Hosting type
No response
SDK information (language and version)
ruby, RoR, Sidekiq, Puma
rarruda, ottony and abigoroth