新手问题 Rubinius 的 Bug ? undefined method `encoding' on nil:NilClass.

kevinzhow · 2013年11月05日 · 最后由 kevinzhow 回复于 2013年11月05日 · 3630 次阅读

换成 Puma + Rubinius 后,Oauth redirect back 到服务器会出这样的问题 这是 Rubinius 的 Bug 么……

切换回去 MRI 问题解决……

Started GET "/auth/twitter" for xxx.xxx.xxx.xxx at 2013-11-05 06:12:42 +0000

NoMethodError (undefined method encoding' on nil:NilClass.):
kernel/delta/kernel.rb:78:inencoding (method_missing)'
rubysl-cgi (2.0.0) lib/cgi/util.rb:7:in escape'
oauth (0.4.7) lib/oauth/tokens/request_token.rb:28:inbuild_authorize_url'
kernel/common/enumerable.rb:49:in collect'
kernel/common/hash.rb:342:ineach'
kernel/common/enumerable.rb:48:in map (collect)'
oauth (0.4.7) lib/oauth/tokens/request_token.rb:28:inbuild_authorize_url'
oauth (0.4.7) lib/oauth/tokens/request_token.rb:9:in authorize_url'
omniauth-oauth (1.0.1) lib/omniauth/strategies/oauth.rb:36:inold_request_phase (request_phase)'
omniauth-twitter (1.0.0) lib/omniauth/strategies/twitter.rb:63:in request_phase'
omniauth (1.1.4) lib/omniauth/strategy.rb:214:inrequest_call'
omniauth (1.1.4) lib/omniauth/strategy.rb:181:in call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:incall'
omniauth (1.1.4) lib/omniauth/builder.rb:49:in call'
mongoid (3.1.4) lib/rack/mongoid/middleware/identity_map.rb:34:incall'
mongoid (3.1.4) lib/mongoid/unit_of_work.rb:39:in unit_of_work'
mongoid (3.1.4) lib/rack/mongoid/middleware/identity_map.rb:34:incall'
warden (1.2.3) lib/warden/manager.rb:35:in call'
kernel/bootstrap/proc.rb:20:incall'
kernel/common/throw_catch.rb:30:in catch'
kernel/common/throw_catch.rb:7:inregister'
kernel/common/throw_catch.rb:29:in catch'
warden (1.2.3) lib/warden/manager.rb:34:incall'
actionpack (3.2.14) lib/action_dispatch/middleware/best_standards_support.rb:17:in call'
rack (1.4.5) lib/rack/etag.rb:23:incall'
rack (1.4.5) lib/rack/conditionalget.rb:25:in call'
actionpack (3.2.14) lib/action_dispatch/middleware/head.rb:14:incall'
actionpack (3.2.14) lib/action_dispatch/middleware/params_parser.rb:21:in call'
actionpack (3.2.14) lib/action_dispatch/middleware/flash.rb:242:incall'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:incall'
actionpack (3.2.14) lib/action_dispatch/middleware/cookies.rb:341:in call'
actionpack (3.2.14) lib/action_dispatch/middleware/callbacks.rb:28:incall'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in _run__1407416434714871310__call__1338411874204908663__callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:inrun_callback'
activesupport (3.2.14) lib/active_support/callbacks.rb:385:in _run_call_callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:81:inrun_callbacks'
actionpack (3.2.14) lib/action_dispatch/middleware/callbacks.rb:27:in call'
actionpack (3.2.14) lib/action_dispatch/middleware/remote_ip.rb:31:incall'
actionpack (3.2.14) lib/action_dispatch/middleware/debug_exceptions.rb:16:in call'
actionpack (3.2.14) lib/action_dispatch/middleware/show_exceptions.rb:56:incall'
railties (3.2.14) lib/rails/rack/logger.rb:32:in call_app'
railties (3.2.14) lib/rails/rack/logger.rb:18:incall'
actionpack (3.2.14) lib/action_dispatch/middleware/request_id.rb:22:in call'
rack (1.4.5) lib/rack/methodoverride.rb:21:incall'
rack (1.4.5) lib/rack/runtime.rb:17:in call'
activesupport (3.2.14) lib/active_support/cache/strategy/local_cache.rb:72:incall'
rack-cache (1.2) lib/rack/cache/context.rb:136:in forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:infetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:incall!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in call'
railties (3.2.14) lib/rails/engine.rb:484:incall'
railties (3.2.14) lib/rails/application.rb:231:in call'
railties (3.2.14) lib/rails/railtie/configurable.rb:30:incall (method_missing)'
puma (2.6.0) lib/puma/configuration.rb:68:in call'
puma (2.6.0) lib/puma/server.rb:486:inhandle_request'
puma (2.6.0) lib/puma/server.rb:357:in process_client'
puma (2.6.0) lib/puma/server.rb:250:inrun'
kernel/bootstrap/proc.rb:20:in call'
puma (2.6.0) lib/puma/thread_pool.rb:92:inspawn_thread'
kernel/bootstrap/proc.rb:20:in call'
kernel/bootstrap/thread.rb:390:inrun__'

检查自己的代码是否线程安全,检查用的库以及依赖的库是否线程安全。

用 Puma + Rubinius 就意味着 “我懂得如何处理线程安全”。

#1 楼 @Rei Thanks!这里是会出问题项目 https://github.com/kevinzhow/railsdemo 以及问题的 issues https://github.com/rubinius/rubinius/issues/2765 如果有闲情可以看一下……

需要 登录 后方可回复, 如果你还没有账号请 注册新账号