2

我的应用程序向 PayPal 发送 https 帖子。使用 Gemfile 中指定的 pg gem,post 操作会导致 WEBBrick 崩溃。如果我将 pg gem 从 Gemfile 中取出,则不会发生崩溃,并且我的帖子正常。(花了很长时间才弄清楚这是导致它的原因,但它是 100% 可重复的。)

更有趣的是,如果我将 pg gem 从 Gemfile 中取出但保持安装状态,一切正常。我将它放回 Gemfile 的那一刻,崩溃再次发生。

两个问题,然后: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 = 真
      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:在“运行”中
/Users/aehven/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `服务'
/Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/rack-1.2.1/lib/rack/handler/webrick.rb:52:in `服务'
/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 `block in call'
/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:in `cache'
/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:in `cache'
/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:in `recognize'
/Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/rack-mount-0.6.13/lib/rack/mount/code_generation.rb:68:in `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:in `识别中的块'
/Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/rack-mount-0.6.13/lib/rack/mount/route_set.rb:148:in `block in call'
/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 `dispatch'
/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:in `block in action'
/Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/action_controller/metal.rb:138:in `dispatch'
/Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/abstract_controller/rendering.rb:40:in `process'
/Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/actionpack-3.0.3/lib/abstract_controller/base.rb:120:in `process'
/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:in `instrument'
/Users/aehven/.rvm/gems/ruby-1.9.2-p180@littlenik/gems/activesupport-3.0.3/lib/active_support/notifications/instrument.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 `block in instrument'
/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:in `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:in `request'
/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:in `start'
/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:in `timeout'
/Users/aehven/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/timeout.rb:44:in `timeout'
/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'
-
4

1 回答 1

2

几乎可以肯定,您的 PostgreSQL 客户端库 (libpq) 是针对与 Ruby 库的 OpenSSL 扩展不同版本的 OpenSSL 编译的。我认为从 gemfile 中删除 'pg' 的原因是让 Ruby 的 libssl 有机会首先加载。

要解决此问题,请针对同一版本的 OpenSSL 编译您使用的所有需要​​ SSL 的内容。

于 2011-06-21T06:16:31.047 回答