我在 Heroku 上托管了一个使用数据库迁移插件的 Grails 应用程序。有时,当应用程序重新启动时,它会在启动时卡住而没有任何帮助消息:
2012-11-12T11:21:06+00:00 app[web.1]: Configuring Spring Security Core ...
2012-11-12T11:21:06+00:00 app[web.1]: ... finished configuring Spring Security Core
2012-11-12T11:21:06+00:00 app[web.1]:
2012-11-12T11:21:22+00:00 heroku[web.1]: Stopping process with SIGKILL
2012-11-12T11:21:22+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2012-11-12T11:21:24+00:00 heroku[web.1]: Process exited with status 137
2012-11-12T11:21:34+00:00 heroku[router]: Error H20 (App boot timeout) -> GET abc.herokuapp.com/ dyno= queue= wait=75000ms service= status=503 bytes=
2012-11-12T11:22:34+00:00 heroku[router]: Error H20 (App boot timeout) -> GET abc.herokuapp.com/ dyno= queue= wait=75000ms service= status=503 bytes=
2012-11-12T11:25:10+00:00 heroku[router]: Error H10 (App crashed) -> GET abc.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
经过一番调查,我发现这是因为 DATABASECHANGELOGLOCK 表上有一条记录,列 LOCKED=TRUE。当我手动将 LOCKED 值设置为 FALSE 并重新启动应用程序时,启动过程会顺利完成。
我的问题是:
- 如何找到导致数据库更改日志锁定的原因以及如何避免它。
- 如果无法避免锁定,有什么方法可以在应用程序启动过程卡住之前清除锁定?