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

时间:2022-06-12 20:40:57

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.

我有一个相当大的Rails应用程序,越来越难以开发。开发环境变得越来越慢,WeBrick正在永远启动。

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?

我是网络开发的新手,只做了一年。我很可能犯了一些错误,导致溢出或二进制文件中的某些错误,而cpu无法处理它。即使代码似乎工作正常并且具有正确的预期结果,情况会是这样吗?

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.

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

1 个解决方案

#1


-1  

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!).

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

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.

关于非法指令问题,请注意你使用的是一个非常“前沿”的混合RoR端Ruby和WEBrick,它的稳定性并不为人所知!选择更保守的解决方案(例如Ruby 1.8.7?)并解雇WEBrick应该可以解决这个问题。

#1


-1  

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!).

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

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.

关于非法指令问题,请注意你使用的是一个非常“前沿”的混合RoR端Ruby和WEBrick,它的稳定性并不为人所知!选择更保守的解决方案(例如Ruby 1.8.7?)并解雇WEBrick应该可以解决这个问题。