Timeout while getting image time_taken

2 views
Skip to first unread message

ri_jtzero

unread,
Apr 3, 2011, 10:29:44 PM4/3/11
to SimpleRecord
I need to get the time the photo was taken and enter it in SDB
but every time I enter it it times out (error at the bottom)
if I remove the line where it sets the :time_taken it runs fine.
heres the model and the controller

class Product < SimpleRecord::Base
has_attributes :name, :price, :time_taken
has_clobs :image
end

# POST /products
# POST /products.xml
def create
@product = Product.new(params[:product])

params[:product][:time_taken] =
(EXIFR::JPEG.new(StringIO.new(params[:produc$

respond_to do |format|
if @product.save
format.html { redirect_to(@product, :notice => 'Product was
successfully$
format.xml { render :xml => @product, :status
=> :created, :location =>$
else
format.html { render :action => "new" }
format.xml { render :xml => @product.errors, :status
=> :unprocessable_$
end
end

end


ERROR:
RequestTimeout: Your socket connection to the server was not read from
or written to within the timeout period. Idle connections will be
closed.
REQUEST=s3.amazonaws.com:443/simple_record_........SNIP

Travis Reeder

unread,
Apr 4, 2011, 2:47:25 AM4/4/11
to simple...@googlegroups.com
Looks like it has to do with s3, is this happening on on the @product.save line?  The line you refer to seems to be cut off in your email btw.


--
You received this message because you are subscribed to the Google Groups "SimpleRecord" group.
To post to this group, send email to simple...@googlegroups.com.
To unsubscribe from this group, send email to simple-recor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/simple-record?hl=en.


ri_jtzero

unread,
Apr 4, 2011, 4:34:16 PM4/4/11
to SimpleRecord
yeah the line cut off looks like this
params[:product][:time_taken] =
(EXIFR::JPEG.new(StringIO.new(params[:product][:image].read)) ||
Time.now)

also yes the item does save all except the image to s3
heres the stack trace

aws (2.4.5) lib/awsbase/awsbase.rb:540:in `request_info_impl'
aws (2.4.5) lib/awsbase/awsbase.rb:293:in `request_info2'
aws (2.4.5) lib/awsbase/awsbase.rb:315:in `request_info3'
aws (2.4.5) lib/s3/s3_interface.rb:181:in `request_info'
aws (2.4.5) lib/s3/s3_interface.rb:430:in `put'
aws (2.4.5) lib/s3/key.rb:130:in `put'
aws (2.4.5) lib/s3/bucket.rb:175:in `put'
simple_record (2.1.3) lib/simple_record.rb:631:in `put_lob'
simple_record (2.1.3) lib/simple_record.rb:607:in `block in save_lobs'
simple_record (2.1.3) lib/simple_record.rb:606:in `each_pair'
simple_record (2.1.3) lib/simple_record.rb:606:in `save_lobs'
simple_record (2.1.3) lib/simple_record.rb:563:in `save_super'
simple_record (2.1.3) lib/simple_record.rb:484:in `do_actual_save'
simple_record (2.1.3) lib/simple_record.rb:517:in `block in create'
activesupport (3.0.3) lib/active_support/callbacks.rb:423:in
`_run_create_callbacks'
simple_record (2.1.3) lib/simple_record.rb:516:in `create'
simple_record (2.1.3) lib/simple_record.rb:506:in `block in
create_or_update'
activesupport (3.0.3) lib/active_support/callbacks.rb:413:in
`_run_save_callbacks'
simple_record (2.1.3) lib/simple_record.rb:505:in `create_or_update'
simple_record (2.1.3) lib/simple_record.rb:460:in `save'
app/controllers/products_controller.rb:53:in `block in create'
actionpack (3.0.3) lib/action_controller/metal/mime_responds.rb:264:in
`call'
actionpack (3.0.3) lib/action_controller/metal/mime_responds.rb:264:in
`retrieve_response_from_mimes'
actionpack (3.0.3) lib/action_controller/metal/mime_responds.rb:191:in
`respond_to'
app/controllers/products_controller.rb:52:in `create'
actionpack (3.0.3) lib/action_controller/metal/implicit_render.rb:4:in
`send_action'
actionpack (3.0.3) lib/abstract_controller/base.rb:151:in
`process_action'
actionpack (3.0.3) lib/action_controller/metal/rendering.rb:11:in
`process_action'
actionpack (3.0.3) lib/abstract_controller/callbacks.rb:18:in `block
in process_action'
activesupport (3.0.3) lib/active_support/callbacks.rb:440:in
`_run__450316295__process_action__167230949__callbacks'
activesupport (3.0.3) lib/active_support/callbacks.rb:409:in
`_run_process_action_callbacks'
activesupport (3.0.3) lib/active_support/callbacks.rb:93:in
`run_callbacks'
actionpack (3.0.3) lib/abstract_controller/callbacks.rb:17:in
`process_action'

On Apr 4, 2:47 am, Travis Reeder <tree...@gmail.com> wrote:
> Looks like it has to do with s3, is this happening on on the @product.save
> line?  The line you refer to seems to be cut off in your email btw.
>

ri_jtzero

unread,
Apr 4, 2011, 8:23:05 AM4/4/11
to SimpleRecord
oops yeah its cut off, sorry when I posted I didnt expect such a quick
response...
yeah the @product still saves to SDB, the line that gets cut off is
this

params[:product][:time_taken] =
(EXIFR::JPEG.new(StringIO.new(params[:product][:image].read)) ||
Time.now)

the stack trace is this
aws (2.4.5) lib/awsbase/awsbase.rb:540:in `request_info_impl'
aws (2.4.5) lib/awsbase/awsbase.rb:293:in `request_info2'
aws (2.4.5) lib/awsbase/awsbase.rb:315:in `request_info3'
aws (2.4.5) lib/s3/s3_interface.rb:182:in `request_info'
aws (2.4.5) lib/s3/s3_interface.rb:431:in `put'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:
30:in `block in process_action'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `block
in instrument'
activesupport (3.0.3) lib/active_support/notifications/instrumenter.rb:
21:in `instrument'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in
`instrument'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:
29:in `process_action'
actionpack (3.0.3) lib/action_controller/metal/rescue.rb:17:in
`process_action'
actionpack (3.0.3) lib/abstract_controller/base.rb:120:in `process'
actionpack (3.0.3) lib/abstract_controller/rendering.rb:40:in
`process'
actionpack (3.0.3) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.3) lib/action_controller/metal/rack_delegation.rb:
14:in `dispatch'
actionpack (3.0.3) lib/action_controller/metal.rb:178:in `block in
action'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:62:in
`call'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:62:in
`dispatch'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:27:in
`call'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in `block in
recognize'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:75:in
`optimized_each'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:92:in
`recognize'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:492:in
`call'
actionpack (3.0.3) lib/action_dispatch/middleware/
best_standards_support.rb:17:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.2) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/params_parser.rb:
21:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/flash.rb:182:in
`call'
actionpack (3.0.3) lib/action_dispatch/middleware/session/
abstract_store.rb:149:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/cookies.rb:295:in
`call'
activerecord (3.0.3) lib/active_record/query_cache.rb:32:in `block in
call'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/
query_cache.rb:28:in `cache'
activerecord (3.0.3) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.3) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/
connection_pool.rb:353:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:46:in
`block in call'
activesupport (3.0.3) lib/active_support/callbacks.rb:415:in
`_run_call_callbacks'
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:44:in
`call'
rack (1.2.2) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/remote_ip.rb:48:in
`call'
actionpack (3.0.3) lib/action_dispatch/middleware/show_exceptions.rb:
46:in `call'
railties (3.0.3) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.2) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.3) lib/active_support/cache/strategy/local_cache.rb:
72:in `call'
rack (1.2.2) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.2) lib/rack/lock.rb:11:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/static.rb:30:in
`call'
railties (3.0.3) lib/rails/application.rb:168:in `call'
railties (3.0.3) lib/rails/application.rb:77:in `method_missing'

On Apr 4, 2:47 am, Travis Reeder <tree...@gmail.com> wrote:
> Looks like it has to do with s3, is this happening on on the @product.save
> line?  The line you refer to seems to be cut off in your email btw.
>

Travis Reeder

unread,
Apr 4, 2011, 8:33:09 PM4/4/11
to simple...@googlegroups.com
Should you be using StringIO on an image? 

ri_jtzero

unread,
Apr 4, 2011, 10:21:48 PM4/4/11
to SimpleRecord
the EXIFR new(file) "file is a filename or an IO object. Hint: use
StringIO when working with slurped data like blobs."

I originally did it this way

params[:product][:time_taken] = (EXIFR::JPEG.new(params[:product]
[:image].tempfile.path).date_time || Time.now.localtime)

neither worked I just posted the StringIO b/c that was the most recent
attempt....

Note: both work if i don't do @product.save. If I just
render :text => params[:product][:time_taken]

On Apr 4, 8:33 pm, Travis Reeder <tree...@gmail.com> wrote:
> Should you be using StringIO on an image?
>

ri_jtzero

unread,
May 9, 2011, 3:48:04 PM5/9/11
to SimpleRecord
I solved this problem, (:facepalm) this

@product = Product.new(params[:product])
params[:product][:time_taken] = ......
should be this

@product = Product.new(params[:product])
@product.image = ......

OR

params[:product][:time_taken] = ......
@product = Product.new(params[:product])

errrgr!!!!
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages