Requests got stuck in ActiveRecord::QueryCache middleware

后端 未结 1 920
南旧
南旧 2021-02-09 04:23

After deploying our Rails app (4.0.9, Ruby 2.1.2), we notice requests to our app get hang after a while , usually 1 day or so.

Using the gem rack_timer, we

1条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-09 04:25

    The most possible cause is your connection with the database died (firewall, server configuration...) and Rails didn't notice, so a timeout happens inside ActiveRecord::QueryCache. Once Rails notices the connection died, it reconnects and the execution flow continues.

    Try setting the param read_timeout in your database.yml file to something like 10 seconds and check your connection and server settings.

    0 讨论(0)
提交回复
热议问题