Async Rails 3.1 资产问题
我在异步 Rails 3.1 应用程序上遇到资产问题,我设法构建了一个最小的示例来显示我的问题,但它对我没有多大帮助。
该应用程序非常简单,我所做的是: - 使用 3.1 创建一个新的应用程序(非 rc) - 添加thin+Rack::FiberPool - 设置波本威士忌(scss mixins) - 运行应用程序
现在我用“rails server Thin”启动一台服务器,之后任何请求都将在“堆栈级别太深”中结束,只有一个回溯行:/
这是最小的应用程序:https://github.com/schmurfy/assets_crash
这是我在执行请求时得到的回溯: http://dl.dropbox.com/u/1313066/github/crash_assets.png
我试图深入了解问题所在,导致我进入文件 template_handlers.rb 中的 sass-rails:
def sass_options(scope)
importer = self.importer(scope)
options = sass_options_from_rails(scope)
load_paths = (options[:load_paths] || []).dup
load_paths.unshift(importer)
# bnding.pry
options.merge(
:filename => eval_file,
:line => line,
:syntax => syntax,
:importer => importer,
:load_paths => load_paths,
:custom => {
:resolver => Resolver.new(scope)
}
)
end
我尝试使用 Pry 进行探索( irb 替代方案),我发现的更令人费解:在 binding.pry 行时,我可以触发堆栈级别太深:
{}.merge(:anything => Resolver.new(scope))
结果是立即的,但我在该对象中找不到任何可以解释结果的内容。
任何线索都会受到欢迎。
I have a problem with assets on an asynchronous rails 3.1 application, I managed to build a minimal example showing my problem but it did not helped me much.
The application is really simple, what I did was:
- create a fresh application with 3.1 (non rc)
- add thin+Rack::FiberPool
- setup bourbon (scss mixins)
- run the application
Now I start a server with "rails server thin", after that any request will end up in a "stack level too deep" with only one backtrace line :/
Here is the minimal application: https://github.com/schmurfy/assets_crash
Here is the backtrace I get when doing a request:
http://dl.dropbox.com/u/1313066/github/crash_assets.png
I tried to dig in to see where the problem was which led me in sass-rails in the file template_handlers.rb:
def sass_options(scope)
importer = self.importer(scope)
options = sass_options_from_rails(scope)
load_paths = (options[:load_paths] || []).dup
load_paths.unshift(importer)
# bnding.pry
options.merge(
:filename => eval_file,
:line => line,
:syntax => syntax,
:importer => importer,
:load_paths => load_paths,
:custom => {
:resolver => Resolver.new(scope)
}
)
end
I tried to explore with Pry (an irb alternative) and what I found is even more puzzling: While at the binding.pry line I can trigger a stack level too deep with:
{}.merge(:anything => Resolver.new(scope))
The result is immediate but I cannot find anything in that object which would explain the result.
Any lead would be welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我终于找到了答案: Fiber 只有 4Kb 的堆栈空间,而 Ruby on Rails 现在太大了,无法容纳这个空间:/
I finally found the answer: fibers only have 4Kb of stack space and Ruby on Rails is now too big to fit in this space :/
我遇到了同样的问题,将我的 ruby 升级到 1.9.3-preview1 并从头开始构建了所有的 gem,现在一切正常。
编辑:
好吧,再玩一会儿之后,看起来确实是 Rack::Fiberpool 导致了这个问题。当我将 Rack::Fiberpool 插入 Rails 堆栈后,它又回来了...
I had the same problem, upgraded my ruby to 1.9.3-preview1 and built all my gems from the ground up now everything works.
EDIT:
OK after playing with it a little more it really seems as if Rack::Fiberpool causes this issue. Got it back after I inserted Rack::Fiberpool back in my Rails stack...
禁用 Rails 中的资产管道。不需要 sass-rails,而是需要 Gemfile 中的 sass 和 sprocket。这是我的 config.ru 来提供资产:
它需要在生产中预编译资产。我稍后会看一下。
Disable assets pipline in rails. Don't require sass-rails but instead require sass and sprockets in Gemfile. Here is my config.ru to serve assets:
It needs to precompile assets in production. I will look on it later.