-
Notifications
You must be signed in to change notification settings - Fork 270
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
Facing timeout issues on migration step #234
Comments
You could use the default env feature of Capistrano to prepend # config/deploy.rb
set :default_env, { MAX_EXECUTION_TIME: "90000" } |
Thanks @mattbrictson. Yeah that would work but recently i came across this https://capistranorb.com/documentation/advanced-features/overriding-capistrano-tasks/. So i am going ahead and using this |
Great thanks for the follow up. Please close this issue once you get it working. |
Sure @mattbrictson. Will close the issue once i test your implementation as well as mine. |
Het @mattbrictson this didn't work. I still faced the timeout issue |
Can you add a debug statement in your app somewhere, maybe # config/boot.rb
puts "MAX_EXECUTION_TIME: #{ENV['MAX_EXECUTION_TIME']}" Also does the capistrano log show that Mysql timeouts are outside my area of expertise so I can't really help you with that part, but please let me know if capistrano is not setting the env as you expect. |
No |
Thanks for following up. I will dig into this some more to see if a bug is lurking in |
I believe there is no issue with |
I tested this and it seems to work fine for me. I configured capistrano as follows: # config/deploy.rb
set :default_env, { MAX_EXECUTION_TIME: "90000" } And modified the Rails app for debugging purposes: # config/boot.rb
puts "MAX_EXECUTION_TIME: #{ENV['MAX_EXECUTION_TIME']}" When I run
As you can see If I look at
|
Perhaps the problem is the
|
Recently we added timeouts for our database with configuration like
Configuration from
database.yml
connect_timeout: 5
read_timeout: 5
write_timeout: 5
checkout_timeout: 5
All values are in seconds
Steps to reproduce
When i run
cap production deploy
the deployment fails on migration step and gives errorMysql2::Error::TimeoutError: Timeout waiting for a response from the last query.
Expected behavior
We want use
MAX_EXECUTION_TIME=90000 rake db:migrate
during our cap deploy and we will add a variablemax_execution_time
in ourdatabase.yml
which will default to 5 seconds.Additionally we could inject
read_timeout
also along with it if the max execution time doesn't work alone.Actual behavior
We cannot control the injection of this variable because our Capfile uses
capistrano/rails
which will runrake db:migrate
without maximum execution time and our migration could take much more time than our DB timeouts.The text was updated successfully, but these errors were encountered: