由於某些原因,處理圖像(carrierwave + minimagick)在服務啓動約一週後停止工作。流量或上傳流程沒有異常增加。一旦發生ENOMEM錯誤,一切似乎都會「鎖定」,並且任何後續進程也會失敗。無法分配內存
一旦處於這種行爲狀態,甚至可以防止這種情況發生,我該如何「拯救」系統?
一些錯誤:
Errno::ENOMEM (Cannot allocate memory - export LANG=C && identify -ping /tmp/mini_magick20111219-18047-1dhmawm.jpg 2>&1):
app/uploaders/photo_uploader.rb:70:in `custom_thumbnail'
app/controllers/upload_controller.rb:186:in `process_upload'
app/middleware/flash_session_cookie_middleware.rb:17:in `call'
app/middleware/flash_session_cookie_middleware.rb:17:in `call'
Errno::ENOMEM (Cannot allocate memory - export LANG=C && mogrify -format jpg /tmp/mini_magick20111219-18047-1c43qpf.jpg 2>&1):
app/controllers/upload_controller.rb:186:in `process_upload'
app/middleware/flash_session_cookie_middleware.rb:17:in `call'
app/middleware/flash_session_cookie_middleware.rb:17:in `call'
...
...
Errno::ENOMEM (Cannot allocate memory - export LANG=C && mogrify -resize "120x180" -gravity "Center" -extent "120x120" /tmp/mini_magick20111219-18047-155ofje.jpg 2>&1):
app/controllers/upload_controller.rb:186:in `process_upload'
app/middleware/flash_session_cookie_middleware.rb:17:in `call'
app/middleware/flash_session_cookie_middleware.rb:17:in `call'
內存和交換空間信息:
Mem: 8193476k total, 7907152k used, 286324k free, 5968k buffers
Swap: 12396808k total, 9494924k used, 2901884k free, 180308k cached
版本信息:
- 的Rails 3.0.6
- 紅寶石1.9.2p290
- 的Apache 2.2.14
- 乘客3.0.9
謝謝!
在Ruby 1.9.3中已經修復了一堆內存泄漏。我會建議升級,看看是否有幫助。 http://svn.ruby-lang.org/repos/ruby/tags/v1_9_3_0/ChangeLog – Thilo 2011-12-19 19:57:10
謝謝Thilo!由於更新內存的處理要好得多。 – Florian 2011-12-21 17:20:31