Non-repeatable "undefined error 'path'" error

I’m seeing an error the first time I run a create after restarting my
webserver (thin). Same create succeeds on all following attempts.

Details:

ruby 1.9.2dev
rails 2.3.2
rack 0.9.1
thin 1.0.0
rmagick 2.9.1

I’m trying to get attachment_fu working in my current setup and have
run into a rather strange situation. The first image I try to load
produces the following diag in the logfile:


Processing ApplicationController#create (for 127.0.0.1 at 2009-04-25
09:50:27) [POST]
Parameters: {“authenticity_token”=>“EjZpcSwOswNpjZCHHhypx/
LdfR8m0AmW1Z2caF4/BVI=”, “mugshot”=>{“uploaded_data”=>#<File:/var/
folders/JP/JP7pZWhAHLy-es7AYViHF++++TI/-Tmp-/RackMultipart3767-2>},
“commit”=>“Create”}

NameError (undefined method path' for classActionController::UploadedStringIO’):
internal:prelude:8:in synchronize' thin (1.0.0) lib/thin/connection.rb:63:inpre_process’
thin (1.0.0) lib/thin/connection.rb:54:in process' thin (1.0.0) lib/thin/connection.rb:39:inreceive_data’
eventmachine (0.12.6) lib/eventmachine.rb:240:in run_machine' eventmachine (0.12.6) lib/eventmachine.rb:240:inrun’
thin (1.0.0) lib/thin/backends/base.rb:57:in start' thin (1.0.0) lib/thin/server.rb:150:instart’

If I then simply reissue the request from the browser the create
action succeeds. From that point on, all attempts to follow the new-

create sequence succeed first try.

Out of curiosity, I tried the same with a new webrick in place of
thin. In that case the first attempt produces:


Processing ApplicationController#create (for ::1 at 2009-04-25
10:20:30) [POST]
Parameters: {“authenticity_token”=>“EjZpcSwOswNpjZCHHhypx/
LdfR8m0AmW1Z2caF4/BVI=”, “mugshot”=>{“uploaded_data”=>#<File:/var/
folders/JP/JP7pZWhAHLy-es7AYViHF++++TI/-Tmp-/RackMultipart4180-2>},
“commit”=>“Create”}

NameError (undefined method path' for classActionController::UploadedStringIO’):
internal:prelude:8:in synchronize' /opt/RoR/lib/ruby/1.9.1/webrick/httpserver.rb:111:inservice’
/opt/RoR/lib/ruby/1.9.1/webrick/httpserver.rb:70:in run' /opt/RoR/lib/ruby/1.9.1/webrick/server.rb:183:inblock in
start_thread’

The browser retry yields a “Webrick - stopped (abort trap)” so no
further attemps are possible. Ignoring for a momemt the different
ways the two servers handle the error allows me to focus on the
common:


NameError (undef…‘path’…‘Act…::UploadedStringIO’)
internal:prelude:8:in `synchronize’

Unfortunately, that’s as far as I can get. I’m clueless on how to
resolve the ‘synchronize’ reference. There’s obviously a point in the
sequence (?rack?) that is not correctly dealing with the
initialization.

The fact that thin will allow a do-over is fortunate for me because it
lets me believe the problem isn’t in my code (for a change;-).

Actually it’s not my code but the trivial “mugshots” example that can
be found through attachment_fu/README. But, in the interest of full
disclosure:

from mugshots_controller.rb

def new
@mugshot = Mugshot.new
end

def create
@mugshot = Mugshot.new(params[:mugshot])
logger.info “Mugshot attributes hash: #
{@mugshot.attributes.inspect}”
logger.info “Mugshots_url: #{mugshots_url.inspect}”
if @mugshot.save
flash[:notice] = ‘Mugshot was successfully created.’
redirect_to mugshots_url
else
render :action => :new
end
end

from mugshots/new.html.erb

<%= error_messages_for :mugshot %>

<% form_for(:mugshot, :url => mugshots_path,
:html => { :multipart => true }) do |f| -%>

Upload A Mugshot: <%= f.file_field :uploaded_data %>

<%= submit_tag 'Create' %>

<% end -%> --------------------------

thanks in advance,
rick

I think it’s a bit too early to run all that stuff on 1.9.2.

Dmitry

certainly a valid reply, not exactly what I was expecting though…

On Apr 25, 1:21 pm, Dmitry S. [email protected]