私のアプリケーションは、PayPal への https 投稿を行います。Gemfile で指定された pg gem を使用すると、post 操作によって WEBBrick がクラッシュします。Gemfile から pg gem を取り出すと、クラッシュは発生せず、投稿は問題なく実行されます。(これが原因だと突き止めるのに永遠にかかりましたが、100% 再現可能です。)
さらに興味深いことに、pg gem を Gemfile から取り出してインストールしたままにしておくと、すべて正常に動作します。Gemfile に戻すとすぐに、クラッシュが再び発生します。
2 つの質問: a) 誰かこれを見たことがありますか? b) pg gem が存在するだけではクラッシュが発生しないのに、Gemfile がクラッシュを引き起こす原因は何ですか?
投稿を行うコードは次のようになります (PayPal SDK からそのまま引用):
# デフペイ パス = "/nvp/" データ = "...." サーバー = "api-3t.sandbox.paypal.com" ポート = 443 header = {"Content-Type" => "html/text"} http = Net::HTTP.new(サーバー、ポート) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE resp = http.post2(パス、データ、ヘッダー) @code = resp.code 終わり
クラッシュが発生したときの出力は次のとおりです。
-- Ruby レベルのバックトレース情報 ---------------------------------------- /Users/aehven/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread' /Users/aehven/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run' /Users/aehven/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:111:「サービス」内 /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/rack-1.2.1/lib/rack/handler/webrick.rb:52:「サービス」内 /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/rack-1.2.1/lib/rack/content_length.rb:13:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/railties-3.0.3/lib/rails/rack/log_tailer.rb:14:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/railties-3.0.3/lib/rails/application.rb:168:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_dispatch/middleware/static.rb:30:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/rack-1.2.1/lib/rack/lock.rb:11:in `call' :10:「同期」中 /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/rack-1.2.1/lib/rack/lock.rb:11:in `呼び出し中のブロック' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/activesupport-3.0.3/lib/active_support/cache/strategy/local_cache.rb:72:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/rack-1.2.1/lib/rack/runtime.rb:17:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/railties-3.0.3/lib/rails/rack/logger.rb:13:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_dispatch/middleware/show_exceptions.rb:46:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_dispatch/middleware/remote_ip.rb:48:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/rack-1.2.1/lib/rack/sendfile.rb:107:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_dispatch/middleware/callbacks.rb:44:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:415:in `_run_call_callbacks' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_dispatch/middleware/callbacks.rb:46:in `block in call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:353:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/activerecord-3.0.3/lib/active_record/query_cache.rb:31:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/activerecord-3.0.3/lib/active_record/query_cache.rb:12:「キャッシュ」内 /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/query_cache.rb:28:「キャッシュ」内 /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/activerecord-3.0.3/lib/active_record/query_cache.rb:32:in `block in call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_dispatch/middleware/cookies.rb:295:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_dispatch/middleware/flash.rb:182:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_dispatch/middleware/params_parser.rb:21:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/rack-1.2.1/lib/rack/methodoverride.rb:24:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_dispatch/middleware/head.rb:14:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_dispatch/routing/route_set.rb:492:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/rack-mount-0.6.13/lib/rack/mount/route_set.rb:139:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/rack-mount-0.6.13/lib/rack/mount/code_generation.rb:92:「認識」中 /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/rack-mount-0.6.13/lib/rack/mount/code_generation.rb:68:「optimized_each」内 /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/rack-mount-0.6.13/lib/rack/mount/code_generation.rb:93:「ブロックイン認識」 /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/rack-mount-0.6.13/lib/rack/mount/route_set.rb:148:in `ブロックインコール' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_dispatch/routing/route_set.rb:27:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_dispatch/routing/route_set.rb:62:in `ディスパッチ' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_dispatch/routing/route_set.rb:62:in `call' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_controller/metal.rb:178:「ブロックインアクション」 /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_controller/metal/rack_delegation.rb:14:in `ディスパッチ' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_controller/metal.rb:138:「ディスパッチ」 /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/abstract_controller/rendering.rb:40:「プロセス」で /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/abstract_controller/base.rb:120:「プロセス」で /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_controller/metal/rescue.rb:17:in `process_action' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_controller/metal/instrumentation.rb:29:in `process_action' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/activesupport-3.0.3/lib/active_support/notifications.rb:52:「楽器」 /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/activesupport-3.0.3/lib/active_support/notifications/instrumenter.rb:21:in `instrument' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/activesupport-3.0.3/lib/active_support/notifications.rb:52:in `ブロックインインストゥルメント' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/abstract_controller/callbacks.rb:17:in `process_action' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:93:in `run_callbacks' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:409:in `_run_process_action_callbacks' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:435:in `_run__1503509404736522407__process_action__285881469255263509__callbacks' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/abstract_controller/callbacks.rb:18:in `block in process_action' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_controller/metal/rendering.rb:11:in `process_action' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/abstract_controller/base.rb:151:in `process_action' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_controller/metal/implicit_render.rb:4:in `send_action' /Users/aehven/Work/Projects/Pico-Tesla/Workspace/trunk/app/controllers/payments_controller.rb:54:「do_DCC」で /Users/aehven/Work/Projects/Pico-Tesla/Workspace/trunk/vendor/plugins/PayPalSDK/lib/caller.rb:70:in `call' /Users/aehven/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:978:in `post' /Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/rest-client-1.6.1/lib/restclient/net_http_ext.rb:17:「リクエスト」 /Users/aehven/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:1168:in `request' /Users/aehven/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:626:「開始」 /Users/aehven/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:637:in `do_start' /Users/aehven/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:678:in `connect' /Users/aehven/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/timeout.rb:87:「タイムアウト」 /Users/aehven/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/timeout.rb:44:「タイムアウト」 /Users/aehven/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:678:in `block in connect' /Users/aehven/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:678:in `connect' -