500/Timeout when trying to send an email with my app?


#1

Hello -

I’m kind of new to this whole web development thing - I have a VPS and
I’ve installed ubuntu 8.04 and postfix on it, and now I’m deploying
simple rails apps to get the hang of the whole process.

So I put together a small forum application, based on the
restful_authentication plugin. I’ve changed user_mailer.rb to reflect
the signup/activation emails that I want to send, but I haven’t modified
restful_authentication beyond that - it’s very basic and vanilla.

So I managed to use mod_rails to get my little app up and running - I
can see the empty forum and everything - but when I go to sign up as a
new user, I submit my information and the browser hangs for a short
while. Finally, it gives me the Rails 500 “We’re sorry, but something
went wrong” screen.

The final entry in production.log is:


Processing UsersController#create (for 62.90.14.161 at 2009-02-06
04:35:22) [POST]
Parameters: {“user”=>{“password_confirmation”=>"(my password)",
“password”=>"(my password)", “login”=>“chris”, “email”=>"(my email
address)"}, “commit”=>“Sign up”,
“authenticity_token”=>“pqOfNV4NB0xZG56nISFIf6jHM7f7KKUoG8FJhG1wvyM=”}
Sent mail to (my email address)

Timeout::Error (execution expired):
/usr/lib/ruby/1.8/timeout.rb:54:in new' /usr/lib/ruby/1.8/net/protocol.rb:206:inold_open’
/usr/lib/ruby/1.8/timeout.rb:56:in timeout' /usr/lib/ruby/1.8/timeout.rb:76:intimeout’
/usr/lib/ruby/1.8/net/protocol.rb:206:in old_open' /usr/lib/ruby/1.8/net/smtp.rb:393:indo_start’
/usr/lib/ruby/1.8/net/smtp.rb:378:in start' actionmailer (2.3.0) lib/action_mailer/base.rb:679:inperform_delivery_smtp’
actionmailer (2.3.0) lib/action_mailer/base.rb:521:in __send__' actionmailer (2.3.0) lib/action_mailer/base.rb:521:indeliver!’
actionmailer (2.3.0) lib/action_mailer/base.rb:393:in method_missing' app/models/user_observer.rb:3:inafter_create’
activerecord (2.3.0) lib/active_record/observer.rb:171:in send' activerecord (2.3.0) lib/active_record/observer.rb:171:inupdate’
/usr/lib/ruby/1.8/observer.rb:185:in notify_observers' /usr/lib/ruby/1.8/observer.rb:184:ineach’
/usr/lib/ruby/1.8/observer.rb:184:in notify_observers' activerecord (2.3.0) lib/active_record/callbacks.rb:329:innotify’
activerecord (2.3.0) lib/active_record/callbacks.rb:322:in callback' activerecord (2.3.0) lib/active_record/callbacks.rb:239:increate’
activerecord (2.3.0) lib/active_record/base.rb:2862:in
create_or_update_without_callbacks' activerecord (2.3.0) lib/active_record/callbacks.rb:222:increate_or_update’
activerecord (2.3.0) lib/active_record/base.rb:2532:in
save_without_validation' activerecord (2.3.0) lib/active_record/validations.rb:1009:insave_without_dirty’
activerecord (2.3.0) lib/active_record/dirty.rb:79:in
save_without_autosave_associations' activerecord (2.3.0) lib/active_record/autosave_association.rb:147:insave_without_transactions’
activerecord (2.3.0) lib/active_record/transactions.rb:229:in send' activerecord (2.3.0) lib/active_record/transactions.rb:229:inwith_transaction_returning_status’
activerecord (2.3.0)
lib/active_record/connection_adapters/abstract/database_statements.rb:136:in
transaction' activerecord (2.3.0) lib/active_record/transactions.rb:182:intransaction’
activerecord (2.3.0) lib/active_record/transactions.rb:228:in
with_transaction_returning_status' activerecord (2.3.0) lib/active_record/transactions.rb:196:insave’
activerecord (2.3.0) lib/active_record/transactions.rb:208:in
rollback_active_record_state!' activerecord (2.3.0) lib/active_record/transactions.rb:196:insave’
app/controllers/users_controller.rb:14:in create' actionpack (2.3.0) lib/action_controller/base.rb:1261:insend’
actionpack (2.3.0) lib/action_controller/base.rb:1261:in
perform_action_without_filters' actionpack (2.3.0) lib/action_controller/filters.rb:617:incall_filters’
actionpack (2.3.0) lib/action_controller/filters.rb:610:in
perform_action_without_benchmark' actionpack (2.3.0) lib/action_controller/benchmarking.rb:68:inperform_action_without_rescue’
actionpack (2.3.0) lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue' actionpack (2.3.0) lib/action_controller/rescue.rb:154:inperform_action_without_flash’
actionpack (2.3.0) lib/action_controller/flash.rb:141:in
perform_action' actionpack (2.3.0) lib/action_controller/base.rb:523:insend’
actionpack (2.3.0) lib/action_controller/base.rb:523:in
process_without_filters' actionpack (2.3.0) lib/action_controller/filters.rb:606:inprocess’
actionpack (2.3.0) lib/action_controller/base.rb:391:in process' actionpack (2.3.0) lib/action_controller/base.rb:386:incall’
actionpack (2.3.0) lib/action_controller/routing/route_set.rb:433:in
call' actionpack (2.3.0) lib/action_controller/dispatcher.rb:65:indispatch’
actionpack (2.3.0) lib/action_controller/dispatcher.rb:88:in _call' actionpack (2.3.0) lib/action_controller/dispatcher.rb:59:ininitialize’
activerecord (2.3.0) lib/active_record/query_cache.rb:29:in call' activerecord (2.3.0) lib/active_record/query_cache.rb:29:incall’
activerecord (2.3.0)
lib/active_record/connection_adapters/abstract/query_cache.rb:34:in
cache' activerecord (2.3.0) lib/active_record/query_cache.rb:9:incache’
activerecord (2.3.0) lib/active_record/query_cache.rb:28:in call' actionpack (2.3.0) lib/action_controller/params_parser.rb:15:incall’
actionpack (2.3.0) lib/action_controller/rewindable_input.rb:25:in
call' actionpack (2.3.0) lib/action_controller/session/cookie_store.rb:93:incall’
actionpack (2.3.0) lib/action_controller/failsafe.rb:11:in call' actionpack (2.3.0) lib/action_controller/rack_ext/lock.rb:15:incall’
actionpack (2.3.0) lib/action_controller/rack_ext/lock.rb:15:in
synchronize' actionpack (2.3.0) lib/action_controller/rack_ext/lock.rb:15:incall’
actionpack (2.3.0) lib/action_controller/dispatcher.rb:83:in `call’

Rendering ./public/500.html (500 Internal Server Error)


I’ve tried this a few times, but it’s always the same. Despite what it
says, I don’t receive any mail at my address. I can use postfix to send
mail from the command line just fine.

I’m thinking that I must have set up postfix wrong, but I’m not sure
how. I followed this guide:
http://articles.slicehost.com/2008/7/29/postfix-installation (I haven’t
done any of the more advanced guides on this site - receiving mail,
multiple domains… it’s all very basic)

So, bottom line, my server can send mail, and when my rails app tries to
send mail it says it succeeds (but doesn’t) and then hangs. Where should
I look now? I’m kind of stumped, and I feel like I’m missing something
really obvious.

Thanks!
Chris


#2

What method of sending mail are you using? Check your logs while you
sen the mail.

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

On 06/02/2009, at 9:24 PM, Chris H. <rails-mailing-list@andreas-


#3

Sorry debt read enough of the mail. Badicall it’s timing out when
sending touour SMTP server. Are u sure the settings are right?

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

On 06/02/2009, at 9:24 PM, Chris H. <rails-mailing-list@andreas-


#4

Ah! All it needed was:

ActionMailer::Base.delivery_method = :sendmail

I was sure I was missing something obvious.

Thanks for your help!
Chris