Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
112 views
in Technique[技术] by (71.8m points)

Rails 4.2: Internal Server Error with Maximum file multiparts in content reached

Just upgraded to Rails 4.2 and I get Internal Server Error on localhost and in production when trying to edit a model with multiple has_many objects. This is the message I see on the rails s console

!! Unexpected error while processing request: Too many open files - Maximum file multiparts in content reached

The request does not even get to the controller i.e., I DO NOT see the usual following lines in rails s console

Started GET "/feeds/3/edit" for 127.0.0.1 at 2015-01-04 20:07:19 -0800
Processing by FeedsController#edit as HTML
......
......

Any clues?? Using Ruby 2.1.5 upgraded to 2.2 with no luck.

question from:https://stackoverflow.com/questions/27773368/rails-4-2-internal-server-error-with-maximum-file-multiparts-in-content-reached

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It looks like the multipart limit was added in the Rails 4.2 version of Rack (https://github.com/rack/rack/commit/b0b5fb9467e6ed777d3eaf35afc81d758e308aab). The default is 128, which may be too little for your purposes, it was for mine. Setting the value to 0 in an initializer removes the limit and fixes the problem:

Rack::Utils.multipart_part_limit = 0

I would suggest tailoring the value until it fits your needs so your server doesn't run out of file handles. My app uses a massive form and setting it to 512 seemed to work for me.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...