# Non-repeatable "undefined error 'path'" error

**URL:** <https://www.ruby-forum.com/t/non-repeatable-undefined-error-path-error/166479>\
**Category:** Rails\
**Created:** [April 25, 2009, 10:39pm UTC](https://www.ruby-forum.com/t/non-repeatable-undefined-error-path-error/166479 "2009-04-25T22:39:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ricklach](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/47e85d/32.png) [@ricklach](https://www.ruby-forum.com/u/ricklach)\
**Post date:** [April 25, 2009, 10:39pm UTC](https://www.ruby-forum.com/t/non-repeatable-undefined-error-path-error/166479/1 "2009-04-25T22:39:34Z")

</div>

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 class`ActionController::UploadedStringIO’): internal:prelude:8:in `synchronize' thin (1.0.0) lib/thin/connection.rb:63:in`pre\_process’ thin (1.0.0) lib/thin/connection.rb:54:in `process' thin (1.0.0) lib/thin/connection.rb:39:in`receive\_data’ eventmachine (0.12.6) lib/eventmachine.rb:240:in `run_machine' eventmachine (0.12.6) lib/eventmachine.rb:240:in`run’ thin (1.0.0) lib/thin/backends/base.rb:57:in `start' thin (1.0.0) lib/thin/server.rb:150:in`start’

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 class`ActionController::UploadedStringIO’): internal:prelude:8:in `synchronize' /opt/RoR/lib/ruby/1.9.1/webrick/httpserver.rb:111:in`service’ /opt/RoR/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run' /opt/RoR/lib/ruby/1.9.1/webrick/server.rb:183:in`block 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

---

<div class="post-metadata">

**Author:** ![ricklach](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/47e85d/32.png) [@ricklach](https://www.ruby-forum.com/u/ricklach)\
**Post date:** [April 26, 2009, 1:22am UTC](https://www.ruby-forum.com/t/non-repeatable-undefined-error-path-error/166479/2 "2009-04-26T01:22:07Z")

</div>

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

Dmitry

---

<div class="post-metadata">

**Author:** ![ricklach](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/47e85d/32.png) [@ricklach](https://www.ruby-forum.com/u/ricklach)\
**Post date:** [April 26, 2009, 6:28am UTC](https://www.ruby-forum.com/t/non-repeatable-undefined-error-path-error/166479/3 "2009-04-26T06:28:34Z")

</div>

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

On Apr 25, 1:21 pm, Dmitry S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
