2015-07-21 71 views
0

我一直在嘗試運行resque任務。 Resque似乎是排隊和執行任務;然而,任務似乎經常在執行時「僵持」。Resque隊列:沒有活動線程?

樣本誤差如下:(從Resque ::失敗輸出取)

{"failed_at"=>"2015/07/20 22:34:46 UTC", 
    "payload"=>{"class"=>"ImportHawaiiEventsOnline", "args"=>[]}, 
    "exception"=>"fatal", 
    "error"=>"No live threads left. Deadlock?", 
"backtrace"=> 
    ["/usr/local/lib/ruby/2.1.0/open3.rb:262:in `value'", 
    "/usr/local/lib/ruby/2.1.0/open3.rb:262:in `block in capture3'", 
    "/usr/local/lib/ruby/2.1.0/open3.rb:199:in `popen_run'", 
    "/usr/local/lib/ruby/2.1.0/open3.rb:93:in `popen3'", 
    "/usr/local/lib/ruby/2.1.0/open3.rb:252:in `capture3'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/shell.rb:47:in `execute_open3'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/shell.rb:36:in `block (2 levels) in execute'", 
    "/usr/local/lib/ruby/2.1.0/timeout.rb:76:in `timeout'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/shell.rb:35:in `block in execute'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/logger.rb:32:in `call'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/logger.rb:32:in `block in benchmark'", 
    "/usr/local/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/logger.rb:32:in `benchmark'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/logger.rb:21:in `debug'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/shell.rb:34:in `execute'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/shell.rb:18:in `run'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/tool.rb:92:in `call'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/tool.rb:53:in `new'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/image.rb:477:in `identify'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/image.rb:198:in `validate!'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/image.rb:113:in `block in create'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/image.rb:112:in `tap'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/image.rb:112:in `create'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/image.rb:34:in `read'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/image.rb:90:in `block in open'", 
    "/usr/local/lib/ruby/2.1.0/open-uri.rb:36:in `open'", 
    "/usr/local/lib/ruby/2.1.0/open-uri.rb:36:in `open'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/mini_magick-4.2.7/lib/mini_magick/image.rb:89:in `open'", 
    "/srv/releases/4/app/uploaders/photo_uploader.rb:57:in `get_geometry'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/processing.rb:84:in `block in process!'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/processing.rb:76:in `each'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/processing.rb:76:in `process!'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/callbacks.rb:18:in `block in with_callbacks'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/callbacks.rb:18:in `each'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/callbacks.rb:18:in `with_callbacks'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/cache.rb:122:in `cache!'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/download.rb:72:in `download!'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/mount.rb:356:in `remote_url='", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/mount.rb:187:in `remote_photo_url='", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/orm/activerecord.rb:45:in `remote_photo_url='", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.1/lib/active_record/attribute_assignment.rb:45:in `public_send'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.1/lib/active_record/attribute_assignment.rb:45:in `_assign_attribute'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.1/lib/active_record/attribute_assignment.rb:32:in `block in assign_attributes'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.1/lib/active_record/attribute_assignment.rb:26:in `each'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.1/lib/active_record/attribute_assignment.rb:26:in `assign_attributes'", 
    "/srv/releases/4/event_jobs/generic_import.rb:45:in `event_endpoint'", 
    "/srv/releases/4/event_jobs/generic_import.rb:113:in `save_event'", 
    "/srv/releases/4/event_jobs/hawaiieventonline/import.rb:26:in `block (2 levels) in get_parser'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:187:in `block in each'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:186:in `upto'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:186:in `each'", 
    "/srv/releases/4/event_jobs/hawaiieventonline/import.rb:24:in `each_with_index'", 
    "/srv/releases/4/event_jobs/hawaiieventonline/import.rb:24:in `block in  get_parser'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:187:in `block in each'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:186:in `upto'", 
    "/srv/releases/4/vendor/bundle/ruby/2.1.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:186:in `each'", 
    "/srv/releases/4/event_jobs/hawaiieventonline/import.rb:21:in `get_parser'", 
    "/srv/releases/4/event_jobs/generic_import.rb:22:in `run_parse'", 
    "/srv/releases/4/app/jobs/import_hawaiieventsonline.rb:17:in `perform'"], 
    "worker"=> 
    "be920dfe9b17:5637:`(queues)`", 
    "queue"=>"`(queue)`"}, 

我猜它曾與mini_magick寶石做的事情 - 雖然它似乎很奇怪,它會建議死鎖因爲我只運行一個線程。我猜想可能是因爲異步請求的數量太大 - 儘管我並不完全理解mini_magick和carrierwave寶石。

有沒有人有什麼建議在哪裏尋找解決這個線程問題?目前,我正在運行17個隊列,其中一個工作線程處理所有這些隊列,而且似乎運行正常 - 只是保存到雲中可能存在問題。試圖搜索與mini_magick/carrierwave相關的任何內容,並且線程問題似乎沒有顯示任何內容。

在此先感謝。

+0

我自己碰到了一個非常類似的錯誤 - 你找到了這個根源嗎? – Codebeef

回答

0

我很好奇,你是否在代碼中運行Resque-Pool或其他分叉/線程? MiniMagick使用open3來運行shell命令,它顯然有一個reputation不適合線程。幸運的是,MiniMagick允許你將open3替換爲Posix-Spawn

我得到了使用線程工作(Resque-Pool作業)相同的錯誤,切換到Posix-Spawn似乎已經解決了我的錯誤。