thoughtbot / paperclip

Easy file attachment management for ActiveRecord
https://thoughtbot.com
Other
9.02k stars 2.43k forks source link

Paperclip crashes Ruby interpreter 1.9.2 #684

Closed zarapustra closed 12 years ago

zarapustra commented 12 years ago

Ruby interpreter frequently crashes when viewing images called with the @user.photo.url method from paperclip. Requires me to restart the server. Sometimes the view shows up fine, I hit F5 without making any changes to any code and it crashes.

Upload is working fine.

Using Ruby 1.9.2 and Rails 3 on Windows 7 x64 (also 32x)

jyurek commented 12 years ago

That sounds pretty bad. Can you paste your has_attached_file and your Gemfile here? Also, what version of Paperclip are you using? Thanks.

zarapustra commented 12 years ago

has_attached_file :photo, :styles => { :medium => "150x200", :thumb => "100x>" }

Using paperclip (2.4.5)

GEMFILE:

source 'http://rubygems.org' gem 'rails', '3.1.0' gem 'sqlite3' gem 'rack', '1.3.3' gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git' gem 'gravatar_image_tag', :git => 'git://github.com/mdeering/gravatar_image_tag.git' gem 'faker', '0.3.1' gem 'will_paginate', '3.0.2' gem 'magic_encoding','~>0.0.2' gem 'pg', :require => 'pg' gem 'stamp', :git => 'git://github.com/jeremyw/stamp.git' gem 'thinking-sphinx', :git => 'git://github.com/freelancing-god/thinking-sphinx.git', :branch => 'master' gem 'devise', :git => 'git://github.com/plataformatec/devise.git' gem 'paperclip', "~> 2.4.5" gem 'compass', '~>0.12.alpha' gem 'crummy', '~> 1.3.5'

group :assets do gem 'sass-rails', " ~> 3.1.0" gem 'coffee-rails', "~> 3.1.0" gem 'uglifier' end gem 'jquery-rails'

group :development do gem 'rspec-rails', '2.6.1' end

jyurek commented 12 years ago

Sorry for leaving you hanging. Is this still a problem? We haven't seen any problems in the meantime and we're using 1.9.2 and Rails 3. Could you supply a stacktrace when the error occurs?

zarapustra commented 12 years ago

there's no reaction in stacktrace when the error occurs. no signs that "something's rotten in the state of Denmark"

jyurek commented 12 years ago

I'm a little confused, then. How do you know it's a paperclip problem? What does happen? Does it hang? That's not quite the same as crashing, which would give you a stack trace.

zarapustra commented 12 years ago

this problem appeared when i started using paperclip. of course I may be mistaken. i'll show you win7's crash window of ruby interpreter. and i'll turn off paperclip to test app without it.

Problem Event Name: APPCRASH Application Name: ruby.exe Application Version: 1.9.2.290 Application Timestamp: 4e20c110 Fault Module Name: msvcrt-ruby191.dll Fault Module Version: 1.9.2.290 Fault Module Timestamp: 4e20c10f Exception Code: c0000005 Exception Offset: 0011a456 OS Version: 6.1.7601.2.1.0.256.1 Locale ID: 1049 Additional Information 1: 5e16 Additional Information 2: 5e16ced789fd81d8061f8a695be3ace3 Additional Information 3: e925 Additional Information 4: e9259da96a9d5a967ce6e9439785c795

when i browsing pages that have no images, no crashes appear.

jyurek commented 12 years ago

Huh, that's a hell of a crash!

Ok, so we're kinda shooting in the dark, then. Just to reduce variables, we should generate as small an app as we can and see what happens. I suppose running the full test suite including the features would work, since they build small apps. I guess one of two things. One, it works, so points to interactions with another gem (not likely, but perhaps). Or two, it doesn't work, and so for some reason your Ruby is messed up and needs to be reinstalled. I only mention this because this is the first report of paperclip crashing the process and not just throwing an uncaught exception.

zarapustra commented 12 years ago

what can i do in order to help?

jyurek commented 12 years ago

You can make a small app on your machine, as small as it needs to be to view an image in a way that would trigger the crash. This will help us isolate the problem.

nycdavid commented 12 years ago

I had this exact same problem.

The way I fixed it was by specifying something different for the :path in the has_attached_file hash. I think it might be something about the images being served out of the public folder that's causing the Ruby interpreter to crash.

The has_attached_file in my Model reads:

has_attached_file :sideimg :url => "/assets/:basename.:extension" end

Thus, accessing the @image.sideimg.url attribute would render: /assets/ and concatenate whatever the file_name is that's stored in the db.

I'm running Rails 3.1.3 on Windows 7, so maybe the Asset Pipeline and Paperclip are conflicting? No idea.

Hope this helps.

kapelner commented 12 years ago

The problem is Windows not paperclip. This is a documented issue with Ruby 1.9.2 and multi-threading. Supposedly it's fixed for 1.9.3

zarapustra commented 12 years ago

I confirm this. Thanks for help!

Ruby 1.9.3-p125 Rails 3.1.4.