每次我更改逻辑时,Rails 应用程序都会收到非法指令

发布于 2024-10-19 21:48:20 字数 459 浏览 2 评论 0原文

我有一个相当大的 Rails 应用程序,开发起来越来越困难。开发环境变得越来越慢,WebBrick 需要很长时间才能启动。

然而,最奇怪的是,每当我更改逻辑(控制器或模型)中的代码时,服务器都会因“非法指令”而崩溃,因此每次更改某些内容时我都必须重新启动服务器。当我改变观点时,这种情况不会发生。

每次重新启动时以及在我们的生产环境中,代码都可以正常工作。

我对网络开发相当陌生,只做了一年。我很可能犯了某种错误,导致溢出或二进制文件中出现CPU无法处理的错误。即使代码看起来运行良好并且具有正确的预期结果,情况是否会如此?

另外,有人可以指导我寻找加速我的开发环境的方法吗?事情开始变得荒谬了。它仅适用于这个特定的存储库。

这是一个 Rails 3.0.4 应用程序,使用 Ruby 1.9.2-p136 和 MYSQL 数据库。使用 Rails 引擎“spree”,这是代码库的主要部分。 WEBrick 是开发服务器。

I have a fairly large Rails app that is getting increasingly harder to develop on. The development environment has gotten slower and slower and WeBrick is taking forever to start up.

The oddest thing however, is that whenever I change code in the logic (controllers or models), the server crashes with an 'Illegal Instruction' so I have to restart the server every time I change something. This doesn't happen when I change the views.

The code works just fine every time I restart as well as in our production environment.

I'm fairly new to web development, only been doing it for a year. It's very possible I'm making some sort of mistake that is causing an overflow or something faulty in the binary that the cpu can't handle it. Could that be the case even though the code seems to work just fine and have the correct expected outcome?

Also, could someone direct me towards finding ways to speed up my development environment. It's starting to get ridiculous. It's only for this particular repository.

It's a Rails 3.0.4 app using Ruby 1.9.2-p136 with MYSQL db. Using the rails engine 'spree' which is the majority of the code base. WEBrick is the development server.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一个人的旅程 2024-10-26 21:48:20

我要做的第一件事就是放弃 WEBrick,因为它的性能很差。您会在网上找到很多关于为什么会这样的文章,几乎所有文章都建议不要在生产环境中使用它,特别是如果您的应用程序足够大的话。我可以建议 thin + nginx,因为我使用它们并且确实没有什么可抱怨的,但最终的选择可能取决于如此多的参数,我强烈建议您首先记录自己那里的不同可能性(并且那里很多!)。

关于非法指令问题,请注意,您正在使用 RoR 端 Ruby 与 WEBrick 的相当“前沿”的组合,而该组合并不以其稳定性而闻名!选择更保守的解决方案(例如 Ruby 1.8.7?)并放弃 WEBrick 应该可以真正解决这个问题。

The first thing I would do is to abandon WEBrick since its performances very poor. You'll find a lot of articles online on why it is so and almost all of them advice not to use it in a production environment, especially if your app is large enough. I could suggest thin + nginx, since I use them and have really nothing to complain about, but a final choice could depend on so many parameters, that I strongly suggest you to first document yourself on the different possibilities out there (and there are a lot!).

With regard to the illegal instruction issue, please notice that you're using a quite "bleeding edge" mix of RoR end Ruby with WEBrick that is not known for its stability! Choosing for a more conservative solution (e.g. Ruby 1.8.7?) and dismissing WEBrick should really solve this problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文