samedi 24 février 2018

Uploading large files with Rails 5 and Carrierwave

I have a HTML form for uploading video files in Rails 5. I am using Carrierwave with the standard generated uploader. Uploader with validation for file extension. When I try to upload large video files (2GB and more), I am getting this error:

Puma caught this error: failed to allocate memory (NoMemoryError)

This is full trace of the error:

Puma caught this error: failed to allocate memory (NoMemoryError) C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/multipart/parser.rb:186:in on_read' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/multipart/parser.rb:72:inblock in parse' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/multipart/parser.rb:70:in loop' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/multipart/parser.rb:70:inparse' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/multipart.rb:52:in extract_multipart' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/request.rb:472:inparse_multipart' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/request.rb:335:in POST' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/method_override.rb:39:inmethod_override_param' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/method_override.rb:27:in method_override' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/method_override.rb:15:incall' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/runtime.rb:22:in call' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/cache/strategy/local_cache_middleware.rb:27:incall' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/executor.rb:12:in call' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rack-livereload-0.3.16/lib/rack/livereload.rb:23:in_call' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rack-livereload-0.3.16/lib/rack/livereload.rb:14:in call' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/static.rb:125:incall' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/sendfile.rb:111:in call' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:522:incall' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/puma-3.10.0/lib/puma/configuration.rb:225:in call' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/puma-3.10.0/lib/puma/server.rb:605:inhandle_request' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/puma-3.10.0/lib/puma/server.rb:437:in process_client' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/puma-3.10.0/lib/puma/server.rb:301:inblock in run' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/puma-3.10.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread'

I am using Windows 10. For production I will switch to Linux, but now I am developing in Windows. May be with Linux I will get same error, I don't know. How to upload large files with Carrierwave (even more than 5GB) ?

Aucun commentaire:

Enregistrer un commentaire