nginx重启问题
我在生产中遇到了一个特殊的一致问题。我正在使用最新的datamapper和ruby-enterprise运行rails3 + nginx
每次部署新版本(触摸restart.txt)时,我都会在部署发生后收到一堆错误(在不同的请求期间发生)。错误并不总是相同:
DataObjects::SQLError: 在查询期间丢失与 MySQL 服务器的连接
ArgumentError: 字段计数不匹配。应有 1 个字段,但查询产生 10
ArgumentError:字段计数不匹配。预期有 10 个字段,但查询产生 1
DataObjects::SQLError: 在查询期间丢失了与 MySQL 服务器的连接
运行其他 Rails 应用程序 (2.3+apache) 时在查询期间丢失了与 MySQL 服务器的连接+ruby-ent)具有活动记录,并且我在重新启动期间从未遇到过任何问题
有人对为什么会发生这种情况以及如何摆脱它有一些建议吗?
谢谢 安德斯
ive a peculiar consistent problem in production. im running rails3 + nginx with latest datamapper and ruby-enterprise
Everytime a deploy a new version (touch restart.txt) i get a bunch of errors (happen during different requests) just after the deploy has happened. The errors are not always the same:
DataObjects::SQLError: Lost connection to MySQL server during query
ArgumentError: Field-count mismatch. Expected 1 fields, but the query yielded 10
ArgumentError: Field-count mismatch. Expected 10 fields, but the query yielded 1
DataObjects::SQLError: Lost connection to MySQL server during query
im running an other rails app (2.3+apache+ruby-ent) with active record and i NEVER EVER had any problem during restarts
Does anyone have some advise on why this happens and how to get rid of it?
thanks
Anders
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您执行 sudo Kill -HUP nginx_pid 时,您是否会遇到相同的错误? (执行 sudo ps aux|grep nginx 来获取 pid)。
您遇到的确实是一组非常奇怪的错误。也许在重新启动时您的数据库仍然有一个会话打开,从而导致数据库池出现问题? Rails 数据库访问通常是间歇性的,但我可以想象如果您有一个长时间运行的数据库查询并尝试重新启动 Rails,就会发生问题。
错误不断变化的事实使我相信这些错误与资源访问有关,而不是与您的配置问题有关。
Do you get the same errors when you do a sudo kill -HUP nginx_pid? (do a sudo ps aux|grep nginx to get the pid).
It is indeed a very strange set of errors you're getting. Perchance you still have a session open to your db while you're restarting, causing problems with your db pool? Rails db access is usually intermittent, but I can imagine issues happening if you have a long running db query going and you attempt to restart Rails.
The fact that the errors keep changing would lead me to believe that the errors are related to resource access, rather than problems with your config.