Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error deleting multi-part tmp files with paperclip #13

Open
wentsul opened this issue Nov 10, 2009 · 2 comments
Open

Error deleting multi-part tmp files with paperclip #13

wentsul opened this issue Nov 10, 2009 · 2 comments

Comments

@wentsul
Copy link

wentsul commented Nov 10, 2009

I'm not sure which part of the process is causing this error so i'll try to be as detailed as possible.

I'm using the following:
Debian GNU/Linux 4.0
Ruby Enterprise Edition 1.8.7-2009.10
Passenger 2.2.5
Rails 2.3.4
Paperclip 2.3.1

I'm a pretty basic uploadify setup that I've tested in production without mod_porter.

Disabling Porter my log file produces the following when uploading a new image:

Processing PhotosController#create to js (for 166.77.6.4 at 2009-11-09 12:25:40) [POST]
Parameters: {"Filename"=>"swatch.jpg", "photo"=>{"swfupload_file"=>#File:/tmp/RackMultipart20091109-18584-j0f5mu-0}, "format"=>"js", "event_id"=>"1", "folder"=>"/events/1/", "action"=>"create", "authenticity_token"=>"JLg7KAsblXr1nBH1N9hdXpAl2mvEJG4KEwcqUd3Fg88=", "_nubuzzphoto_session"=>"BAh7CiIVdXNlcl9jcmVkZW50aWFscyIBgGEwNDM2NzIyYmE0ZGNjYzlmMWNlY2QzNTc4Y2NkYzczMTY2OWUzMWQxOWI0YjcyYjgxMjAyM2QwMGJkYTA2Yjc0NjkyYTI1NWQ4NWFmODg1N2JiNGI0YTNjYzM5NGZjODljMWRmMTY0ZDQ1ZjUzMDRmOGFmNDYwYjZhYmU5Njg5OhBfY3NyZl90b2tlbiIxSkxnN0tBc2JsWHIxbkJIMU45aGRYcEFsMm12RUpHNEtFd2NxVWQzRmc4OD0iCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2VkewAiGHVzZXJfY3JlZGVudGlhbHNfaWRpBjoPc2Vzc2lvbl9pZCIlYWNlOGJjYzExYjNiMmQxN2IwZjEyYTUxODZjZWFmZDc=--a93f6df995a420d8f96712362de3e7f767720092", "Upload"=>"Submit Query", "controller"=>"photos"}
[paperclip] Saving attachments.
[paperclip] saving /home/deploy/apps/localhost/releases/20091109224605/public/assets/photos/17/small/swatch.jpg
[paperclip] saving /home/deploy/apps/localhost/releases/20091109224605/public/assets/photos/17/large/swatch.jpg
[paperclip] saving /home/deploy/apps/localhost/releases/20091109224605/public/assets/photos/17/thumbnail/swatch.jpg
[paperclip] saving /home/deploy/apps/localhost/releases/20091109224605/public/assets/photos/17/original/swatch.jpg
[paperclip] saving /home/deploy/apps/localhost/releases/20091109224605/public/assets/photos/17/sort/swatch.jpg
Rendering photos/create
Completed in 453ms (View: 29, DB: 41) | 200 OK [http://localhost/events/1/photos]

This creates a Rack multipart file in my /tmp directory that looks like the following

-rw------- 1 deploy deploy 504 2009-11-09 12:25 RackMultipart20091109-18584-j0f5mu-0

Everything seems to be working fine here.

Now when turn mod porter on I get the following error in my log file:

Processing PhotosController#create to js (for 166.77.6.4 at 2009-11-09 12:15:16) [POST]
Parameters: {"Filename"=>"swatch.jpg", "photo"=>{"swfupload_file"=>{"content_type"=>"application/octet-stream", "signature"=>"6cqlC0+L6q+2Kw77sXVs3W5FWcA=", "filename"=>"swatch.jpg", "path"=>"/tmp/apreqBSqWD9"}}, "format"=>"js", "event_id"=>"1", "folder"=>"/events/1/", "action"=>"create", "authenticity_token"=>"JLg7KAsblXr1nBH1N9hdXpAl2mvEJG4KEwcqUd3Fg88=", "_nubuzzphoto_session"=>"BAh7CiIVdXNlcl9jcmVkZW50aWFscyIBgGEwNDM2NzIyYmE0ZGNjYzlmMWNlY2QzNTc4Y2NkYzczMTY2OWUzMWQxOWI0YjcyYjgxMjAyM2QwMGJkYTA2Yjc0NjkyYTI1NWQ4NWFmODg1N2JiNGI0YTNjYzM5NGZjODljMWRmMTY0ZDQ1ZjUzMDRmOGFmNDYwYjZhYmU5Njg5OhBfY3NyZl90b2tlbiIxSkxnN0tBc2JsWHIxbkJIMU45aGRYcEFsMm12RUpHNEtFd2NxVWQzRmc4OD0iCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2VkewAiGHVzZXJfY3JlZGVudGlhbHNfaWRpBjoPc2Vzc2lvbl9pZCIlYWNlOGJjYzExYjNiMmQxN2IwZjEyYTUxODZjZWFmZDc=--a93f6df995a420d8f96712362de3e7f767720092", "Upload"=>"Submit Query", "controller"=>"photos"}
Processing ["photo[swfupload_file]"]
[paperclip] Saving attachments.
[paperclip] saving /home/deploy/apps/localhost/releases/20091109224605/public/assets/photos/16/small/swatch.jpg
[paperclip] saving /home/deploy/apps/localhost/releases/20091109224605/public/assets/photos/16/large/swatch.jpg
[paperclip] saving /home/deploy/apps/localhost/releases/20091109224605/public/assets/photos/16/thumbnail/swatch.jpg
[paperclip] saving /home/deploy/apps/localhost/releases/20091109224605/public/assets/photos/16/original/swatch.jpg

Errno::EPERM (Operation not permitted - /tmp/apreqBSqWD9):
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/1.8/fileutils.rb:1297:in unlink' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/1.8/fileutils.rb:1297:inremove_file'
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/1.8/fileutils.rb:1302:in platform_support' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/1.8/fileutils.rb:1296:inremove_file'
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/1.8/fileutils.rb:1285:in remove' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/1.8/fileutils.rb:756:inremove_entry'
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/1.8/fileutils.rb:1339:in postorder_traverse' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/1.8/fileutils.rb:754:inremove_entry'
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/1.8/fileutils.rb:511:in mv' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/1.8/fileutils.rb:1395:infu_each_src_dest'
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/1.8/fileutils.rb:1411:in fu_each_src_dest0' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/1.8/fileutils.rb:1393:infu_each_src_dest'
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/1.8/fileutils.rb:494:in mv' app/controllers/photos_controller.rb:29:increate'
app/controllers/photos_controller.rb:28:in create' haml (2.2.5) [v] lib/sass/plugin/rails.rb:19:inprocess_without_compass'
vendor/gems/chriseppstein-compass-0.8.16/lib/compass/app_integration/rails/action_controller.rb:7:in process' app/middleware/flash_session_cookie_middleware.rb:17:incall'
passenger (2.2.5) lib/phusion_passenger/rack/request_handler.rb:95:in process_request' passenger (2.2.5) lib/phusion_passenger/abstract_request_handler.rb:207:inmain_loop'
passenger (2.2.5) lib/phusion_passenger/railz/application_spawner.rb:378:in start_request_handler' passenger (2.2.5) lib/phusion_passenger/railz/application_spawner.rb:336:inhandle_spawn_application'
passenger (2.2.5) lib/phusion_passenger/utils.rb:183:in safe_fork' passenger (2.2.5) lib/phusion_passenger/railz/application_spawner.rb:334:inhandle_spawn_application'
passenger (2.2.5) lib/phusion_passenger/abstract_server.rb:352:in __send__' passenger (2.2.5) lib/phusion_passenger/abstract_server.rb:352:inmain_loop'
passenger (2.2.5) lib/phusion_passenger/abstract_server.rb:196:in start_synchronously' passenger (2.2.5) lib/phusion_passenger/abstract_server.rb:163:instart'
passenger (2.2.5) lib/phusion_passenger/railz/application_spawner.rb:213:in start' passenger (2.2.5) lib/phusion_passenger/spawn_manager.rb:262:inspawn_rails_application'
passenger (2.2.5) lib/phusion_passenger/abstract_server_collection.rb:126:in lookup_or_add' passenger (2.2.5) lib/phusion_passenger/spawn_manager.rb:256:inspawn_rails_application'
passenger (2.2.5) lib/phusion_passenger/abstract_server_collection.rb:80:in synchronize' passenger (2.2.5) lib/phusion_passenger/abstract_server_collection.rb:79:insynchronize'
passenger (2.2.5) lib/phusion_passenger/spawn_manager.rb:255:in spawn_rails_application' passenger (2.2.5) lib/phusion_passenger/spawn_manager.rb:154:inspawn_application'
passenger (2.2.5) lib/phusion_passenger/spawn_manager.rb:287:in handle_spawn_application' passenger (2.2.5) lib/phusion_passenger/abstract_server.rb:352:insend'
passenger (2.2.5) lib/phusion_passenger/abstract_server.rb:352:in main_loop' passenger (2.2.5) lib/phusion_passenger/abstract_server.rb:196:instart_synchronously'

Operation not permitted - /tmp/apreqBSqWD9

This creates a apreq file in my /tmp directory that looks like the following

-rw------- 1 deploy deploy 1264 2009-11-09 12:15 apreqBSqWD9,18387,3

The error prohibits the record from being created but Paperclip is correctly processing the images which are generated on the filesystem correctly.

I tried changing the PorterPermission to 0×0777 but that doesn't seem to be the problem anyway.

This might not be an issue with ModPorter because it doesn't have anything to do with modifying the file uploaded but I thought someone might be able to help.

Thanks.

@joe1chen
Copy link

joe1chen commented Jul 2, 2010

I was running into this issue as well. I was able to fix the problem by making sure that Apache and the owner of the environment.rb were the same user. In my case, I changed the Apache run user to match the owner of environment.rb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@wentsul @joe1chen and others