lundi 22 avril 2019

calling send_data with filepath, file is getting deleted and send_data throwing "No such file or directory @ rb_sysopen"

I am trying to download xls file using send_file file_path, :content_type => "application/vnd.ms-excel", :filename => File.basename(file_path) But getting error as "No such file or directory @ rb_sysopen".

I am using rails 3.2.21 and corresponding actionpack 3.2.21

I have added File.exist?(file_path) which is returning true. But on execution of send_file method the file is getting deleted and throwing error. Below is stacktrace

App 9174 stderr: [ 2019-04-22 17:01:07.8144 9229/0x005579aae50758(Worker 1) utils.rb:85 ]: *** Exception Errno::ENOENT in Rack response body object (No such file or directory @ rb_sysopen - /usr/share/app_name/public/data-20190422-170057.xls) (process 9229, thread 0x005579aae50758(Worker 1)):
App 9174 stderr:        from /usr/lib/ruby-flo/lib/ruby/gems/2.2.0/gems/actionpack-3.2.21/lib/action_controller/metal/data_streaming.rb:93:in `initialize'
App 9174 stderr:        from /usr/lib/ruby-flo/lib/ruby/gems/2.2.0/gems/actionpack-3.2.21/lib/action_controller/metal/data_streaming.rb:93:in `open'
App 9174 stderr:        from /usr/lib/ruby-flo/lib/ruby/gems/2.2.0/gems/actionpack-3.2.21/lib/action_controller/metal/data_streaming.rb:93:in `each'
App 9174 stderr:        from /usr/lib/ruby-flo/lib/ruby/gems/2.2.0/gems/actionpack-3.2.21/lib/action_dispatch/http/response.rb:44:in `each'
App 9174 stderr:        from /usr/lib/ruby-flo/lib/ruby/gems/2.2.0/gems/activerecord-3.2.21/lib/active_record/query_cache.rb:46:in `each'
App 9174 stderr:        from /usr/lib/ruby-flo/lib/ruby/gems/2.2.0/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_pool.rb:460:in `each'
App 9174 stderr:        from /usr/lib/ruby-flo/lib/ruby/gems/2.2.0/gems/rack-1.4.7/lib/rack/body_proxy.rb:31:in `each'
App 9174 stderr:        from /usr/lib/ruby-flo/lib/ruby/gems/2.2.0/gems/passenger-5.0.15/lib/phusion_passenger/rack/thread_handler_extension.rb:297:in `process_body'
App 9174 stderr:        from /usr/lib/ruby-flo/lib/ruby/gems/2.2.0/gems/passenger-5.0.15/lib/phusion_passenger/rack/thread_handler_extension.rb:143:in `process_request'
App 9174 stderr:        from /usr/lib/ruby-flo/lib/ruby/gems/2.2.0/gems/passenger-5.0.15/lib/phusion_passenger/request_handler/thread_handler.rb:157:in `accept_and_process_next_request'
App 9174 stderr:        from /usr/lib/ruby-flo/lib/ruby/gems/2.2.0/gems/passenger-5.0.15/lib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
App 9174 stderr:        from /usr/lib/ruby-flo/lib/ruby/gems/2.2.0/gems/passenger-5.0.15/lib/phusion_passenger/request_handler.rb:415:in `block (3 levels) in start_threads'
App 9174 stderr:        from /usr/lib/ruby-flo/lib/ruby/gems/2.2.0/gems/passenger-5.0.15/lib/phusion_passenger/utils.rb:111:in `block in create_thread_and_abort_on_exception'
[ 2019-04-22 17:01:07.8150 9011/7efd5ffff700 Ser/Server.h:929 ]: [Client 1-2] Disconnecting client with error: error parsing app response chunked encoding: unexpected end-of-stream

This was working with rails 3.1.3 but due to our OS upgradation we have to upgrade rails 3.2.21 and this is getting break. Let me know if any other input I should provide.

Aucun commentaire:

Enregistrer un commentaire