2017-10-15 21 views
0

私はある種のsocksproxy呼び出しを行うresque-poolを使って実行する単純なバックグラウンドジョブを持っています。私は生産にSOCKSProxyの接続タイムアウトresque Railsプロダクションモードでの呼び出し

  • Railsのコンソールで実行したときに同じコードが動作するバックグラウンドジョブ

    で接続タイムアウトを打つとすぐに、私は本番モードに変更するとRailsの開発モードでresqueプールを起動したときにこれが正常に動作します

    req = Net::HTTP::Get.new(uri.request_uri) 
    response = Net::HTTP.SOCKSProxy(@socks_server, @socks_port).start(uri.host, uri.port) do |http| 
        http.request(req) 
    end 
    
    :モード
  • コマンドラインから起動
  • スタンドアロンRubyスクリプトは

呼び出しは何かのようなものです

調査:

このコールが起こる

TCPSocket.open(conn_address, conn_port, @local_host, @local_port) 

net/http.rbで私は、本番モードワーカー子プロセスの代わりに、ロード中に、それはまだルビーからロードされるsocksify-1.7.0/lib/socksify.rbから TCPSocketクラスはresolv-replace.rbられていました。しかし、なぜか分からない。私が見

エラー:

接続がタイムアウト - 接続(2) "" ポート6455のために: /usr/lib/ruby/gems/2.1.0/gems/socksify-1.7.0/ lib/socksify.rb:178: initialize' /usr/lib/ruby/gems/2.1.0/gems/socksify-1.7.0/lib/socksify.rb:178:in 初期化 '/usr/lib/ruby/2.1.0/resolv-replace.rb:23:in initialize' /usr/lib/ruby/2.1.0/net/http.rb:879:in open' /usr/lib/ruby/2.1.0/net/ http:rb:879:block in connect' /usr/lib/ruby/2.1.0/timeout.rb:76:inタイムアウト ' /usr/lib/ruby/2.1.0/net/http.rb:878:in connect' /usr/lib/ruby/2.1.0/net/http.rb:863:in do_start' /usr/lib/ruby/2.1.0/net/http。 rb:852:start' /usr/lib/ruby/2.1.0/net/http.rb:583:in start ' /usr/lib/ruby/gems/2.1.0/ge ms/retries-0.0.5/lib/retries.rb:46: call' /usr/lib/ruby/gems/2.1.0/gems/retries-0.0.5/lib/retries.rb:46:in with_retries ' /usr/lib/ruby/gems/2.1.0/gems/resque-1.26.0/lib/resque/job.rb :177: block (3 levels) in perform' /usr/lib/ruby/gems/2.1.0/gems/newrelic_rpm-3.16.2.321/lib/new_relic/agent/instrumentation/resque.rb:41:in ブロックの「 /usr/lib/ruby/gems/2.1.0/gems/newrelic_rpm-3.16.2.321/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:363:in `perform_action_with_newrelic_traceをaround_perform_with_monitoringで around_perform_with_monitoring' /usr/lib/ruby/gems/2.1.0/gems/resque-1.26.0/lib/resque/job.rb:176:in ブロック(2つのレベル)/usr/lib/ruby/gems/2.1.0/gems/newrelic_rpm-3.16.2.321/lib/new_relic/agent/instrumentation/resque.rb:33:in '

' /usr/lib/ruby/gems/2.1.0/gems/resque-1.26'を実行してください。 0/lib/resque/job.rb:172:in call' /usr/lib/ruby/gems/2.1.0/gems/resque-1.26.0/lib/resque/job.rb:172:in 実行中のブロック(3レベル) '../app/jobs/resque_hooks.rb:15:in around_perform_job_duration' /usr/lib/ruby/gems/2.1.0/gems/resque-1.26.0/lib/resque/job.rb:172:in 実行中のブロック(2レベル)' /usr /lib/ruby/gems/2.1.0/gems/resque-1.26.0/lib/resque/job.rb:184:in call' /usr/lib/ruby/gems/2.1.0/gems/resque-1.26.0/lib/resque/job.rb:184:in perform ' /usr/lib/ruby/gems/2.1.0/gems/ resque-1.26.0/lib/resque/worker.rb:290: perform' /usr/lib/ruby/gems/2.1.0/gems/resque-1.26.0/lib/resque/worker.rb:229:in ブロック作業中 ' /usr/lib/ruby/gems/2.1.0/gems/resque-1.26.0/lib/resque/worker .rb:206:in loop' /usr/lib/ruby/gems/2.1.0/gems/resque-1.26.0/lib/resque/worker.rb:206:in work ' /usr/lib/ruby/gems/2.1.0/gems/resque-pool-0.6.0/lib/resque/pool。RB:396: block in spawn_worker!' /usr/lib/ruby/gems/2.1.0/gems/resque-pool-0.6.0/lib/resque/pool.rb:389:in フォークで ' spawn_worker!' /usr/lib/ruby/gems/2.1.0/gems/resque-pool-0.6.0/lib/resque/pool.rb:367:in /usr/lib/ruby/gems/2.1.0/gems/resque-pool-0.6.0/lib/resque/pool.rb:389:inブロックspawn_missing_workers_forで' /usr/lib/gems/2.1.0/gems/resque-pool-0.6.0/lib/resque/pool.rb:366:in times' /usr/lib/ruby/gems/2.1.0/gems/resque-pool-0.6.0/lib/resque/pool.rb:366:in spawn_missing_workers_for ' /usr/lib/ruby/gems/2.1 .0/gems/resque-pool-0.6.0/lib/resque/pool.rb:352: block in maintain_worker_count' /usr/lib/ruby/gems/2.1.0/gems/resque-pool-0.6.0/lib/resque/pool.rb:350:in それぞれ ' /usr/lib/ruby/gems/2.1.0/gems/resque-pool-0.6。 0/lib/resque/pool.rb:350:in maintain_worker_count' /usr/lib/ruby/gems/2.1.0/gems/resque-pool-0.6.0/lib/resque/pool.rb:263:in start ' /usr/lib/ruby/gems/2.1.0/gems/resque-pool-0.6.0/lib/resque/pool.rb:89 : ' のブロック0(2レベル)/usr/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rak/task.rb:248:in call' /usr/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:248:in 実行ブロック' /usr /lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:243:in each' /usr/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:243:in 実行 ' /usr/lib/ruby/gems/2.1.0/gems/エアブレーキ-5.5.0/libに/エアブレーキ/熊手/ task_ext.rb:19:mon_synchronize' /usr/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:180:in /usr/lib/ruby/2.1.0/monitor.rb:211:in invoke_with_call_chainで execute' /usr/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:187:in ブロックで

invoke_with_call_chain

答えて

0

これ以上調べてみると、それはnewrelic gem enabled i n生産モード。 newrelicはresolv-replaceを必要とします。これは、socksify gemとうまくいって、バックグラウンドジョブを再開しませんでした。もう新しい遺物は必要ないので、単にそれを無効にするだけで私はこの問題を克服することができました。

関連する問題