Уровень стека слишком глубокий при компиляции файлов javascript в ElasticBeanstalk Ruby2.0 на Rails3
Я пытаюсь перенести наше приложение Rails3 из старой среды ElasticBeanstalk под управлением Ruby 1.9.3 на новое приложение под управлением Ruby 2.0.
Кажется, что все работает нормально, за исключением ошибки "слишком большой уровень стека" в файлах прекомпиляции ресурсов javascript (компиляция css работала хорошо). Он отлично работает на моем ноутбуке с установленными Gems. Ниже приведена трассировка стека, любое предложение будет полезно. Заранее спасибо.
[webapp@ip-10-126-10-155 current]$ rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/usr/bin/ruby2.0 /usr/local/bin/rake assets:precompile:all RAILS_ENV=staging RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
SystemStackError: stack level too deep
(in /var/app/current/app/assets/javascripts/all.js)
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/task.rb:183
Tasks: TOP => assets:precompile:primary
rake aborted!
Command failed with status (1): [/usr/bin/ruby2.0 /usr/local/bin/rake asset...]
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/file_utils.rb:54:in `block in create_shell_runner'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/file_utils.rb:45:in `call'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/file_utils.rb:45:in `sh'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/file_utils_ext.rb:37:in `sh'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/file_utils.rb:82:in `ruby'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/file_utils_ext.rb:37:in `ruby'
/usr/local/share/ruby/gems/2.0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/usr/local/share/ruby/gems/2.0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/usr/local/share/ruby/gems/2.0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/task.rb:240:in `call'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/task.rb:240:in `block in execute'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/task.rb:235:in `each'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/task.rb:235:in `execute'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/share/ruby/2.0/monitor.rb:211:in `mon_synchronize'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/task.rb:165:in `invoke'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/application.rb:150:in `invoke_task'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/application.rb:106:in `each'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/application.rb:106:in `block in top_level'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/application.rb:115:in `run_with_threads'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/application.rb:100:in `top_level'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/application.rb:78:in `block in run'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/lib/rake/application.rb:75:in `run'
/usr/local/share/ruby/gems/2.0/gems/rake-10.3.1/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
Tasks: TOP => assets:precompile
1 ответ
Решение
Я наконец нашел причину. Это из-за этих строк кода, которые были для поддержки Emoji.
module ActiveSupport
module JSON
module Encoding
class << self
def escape_with_json_gem(string)
::JSON.generate([string])[1..-2]
end
alias_method_chain :escape, :json_gem
end
end
end
end