2012-02-29 28 views
7

Sáng nay tôi đang gặp các lỗi sau:RSpec và Machinist lỗi: Quá nhiều file mở

14) Deal on creation sets frozen to false or nil 
    Failure/Error: Unable to find matching line from backtrace 
    Errno::EMFILE: 
     Too many open files - identify -format %wx%h '/var/folders/BJ/BJcTANEBFxWcan28U2YEKE+++TI/-Tmp-/stream20120229-36866-4l1sa8.gif[0]' 
    # ./spec/support/blueprints.rb:29:in `block in <top (required)>' 

Specs là như vậy damn chậm (ngay cả với Spork) vì vậy họ là vô ích. Mất 9 phút để chạy 20 ví dụ trong một mô hình. Dòng 29 trong blueprint.rb là giữa các khối sau:

Company.blueprint do 
    name { "Office Tronic#{rand(10 ** 10)}" } 
    website { 'officetronic.com' } 
    subdomain {"officetronic#{rand(10 ** 10)}"} 
    facebook { 'officetronic' } 
    twitter { 'officetronic' } 
    description { 'We are a company dealing with electronics and office supply' } 
    address_line1 {'34 John Street'} 
    address_line2 {''} 
    post_code { 'EC2 3RR' } 
    phone { '01 343243434' } 
    city { 'London' } 
    your_name { 'john Doe' } 
    font_colour {'000000'} 
    logo_file_name { 'mylogo.png' } 
    logo_content_type { "application/png" } 
    logo_file_size { 100 } 
end 

Deal.blueprint do 
    company {Company.make!} 
    title { '50% off for web sites dev' } 
    description { '50% of discount...' } 
    quantity { 1 } 
    min_quantity { 0 } 
    start_time { Chronic.parse('one month') } 
    end_time { Chronic.parse('two months') } 
    price { 1500 } # in cents 
    shipping_cost{ 100 } # in cents 
    published { true } 
    small_print { 'Some text' } 
    show_map { true } 
    post_code { 'E1 6BJ' } 
    rrp {15} 
end 
+0

Tôi nhận thấy rằng lỗi này xảy ra khi sử dụng spork: rspec --drb spec/models/deal_spec.rb – rtacconi

Trả lời

10

Quá nhiều file mở là một lỗi hệ điều hành, có nghĩa là hệ điều hành đã chạy ra khỏi xử lý tập tin. Linux thường có giới hạn cứng về số lượng tệp có thể mở cùng một lúc và đã đạt đến giới hạn đó.

Để tăng giới hạn tạm thời, trước tiên hãy chạy ulimit -n 8192 trước rồi chạy thông số kỹ thuật.

Để tăng giới hạn vĩnh viễn, follow these instructions và thay thế nginx bằng tên tài khoản người dùng mà bạn đang sử dụng để chạy thông số.

Các vấn đề liên quan