Rails 3 Errno::EAFNOSUPPORT: Address family not supported by protocol - socket(2)

Hi Guys,

Facing a weird error .

Errno::EAFNOSUPPORT: Address family not supported by protocol - socket(2)

It seems to be happening with mail sending mail . I am using AUTHSMTP to send mails . Unable to send mail and the app breaks .

Any help will be appreciated . Same code worked with ruby 1.8 and rails 2.3.x .

Configuration

Rails 3.2

Ruby 1.9

Engineyard , Linux Instance

Backtrace :

/usr/lib/ruby/1.9.1/net/smtp.rb:540:in `initialize'

/usr/lib/ruby/1.9.1/net/smtp.rb:540:in `open'

/usr/lib/ruby/1.9.1/net/smtp.rb:540:in `tcp_socket'

/usr/lib/ruby/1.9.1/net/smtp.rb:549:in `block in do_start'

/usr/lib/ruby/1.9.1/timeout.rb:68:in `timeout'

/usr/lib/ruby/1.9.1/timeout.rb:99:in `timeout'

/usr/lib/ruby/1.9.1/net/smtp.rb:549:in `do_start'

/usr/lib/ruby/1.9.1/net/smtp.rb:519:in `start'

[GEM_ROOT]/gems/mail-2.4.4/lib/mail/network/delivery_methods/smtp.rb:144:in `deliver!'

[GEM_ROOT]/gems/mail-2.4.4/lib/mail/message.rb:2034:in `do_delivery'

[GEM_ROOT]/gems/mail-2.4.4/lib/mail/message.rb:229:in `block in deliver'

[GEM_ROOT]/gems/actionmailer-3.2.3/lib/action_mailer/base.rb:414:in `block in deliver_mail'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/notifications.rb:123:in `block in instrument'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/notifications.rb:123:in `instrument'

[GEM_ROOT]/gems/actionmailer-3.2.3/lib/action_mailer/base.rb:412:in `deliver_mail'

[GEM_ROOT]/gems/mail-2.4.4/lib/mail/message.rb:229:in `deliver'

app/controllers/access_code_controller.rb:102:in `save_code_request'

app/controllers/access_code_controller.rb:22:in `send_email'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_controller/metal/implicit_render.rb:4:in `send_action'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/abstract_controller/base.rb:167:in `process_action'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_controller/metal/rendering.rb:10:in `process_action'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/abstract_controller/callbacks.rb:18:in `block in process_action'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:448:in `block in _run__165131660__process_action__288621973__callbacks'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_1400'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:326:in `around'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:310:in `_callback_around_13'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:214:in `_conditional_callback_around_1400'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:414:in `_run__165131660__process_action__288621973__callbacks'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in `__run_callback'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:81:in `run_callbacks'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/abstract_controller/callbacks.rb:17:in `process_action'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_controller/metal/rescue.rb:29:in `process_action'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/notifications.rb:123:in `block in instrument'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/notifications.rb:123:in `instrument'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_controller/metal/instrumentation.rb:29:in `process_action'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_controller/metal/params_wrapper.rb:205:in `process_action'

[GEM_ROOT]/gems/activerecord-3.2.3/lib/active_record/railties/controller_runtime.rb:18:in `process_action'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/abstract_controller/base.rb:121:in `process'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/abstract_controller/rendering.rb:45:in `process'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_controller/metal.rb:203:in `dispatch'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_controller/metal.rb:246:in `block in action'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:73:in `call'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:36:in `call'

[GEM_ROOT]/gems/journey-1.0.3/lib/journey/router.rb:68:in `block in call'

[GEM_ROOT]/gems/journey-1.0.3/lib/journey/router.rb:56:in `each'

[GEM_ROOT]/gems/journey-1.0.3/lib/journey/router.rb:56:in `call'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:600:in `call'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'

[GEM_ROOT]/gems/rack-1.4.1/lib/rack/etag.rb:23:in `call'

[GEM_ROOT]/gems/rack-1.4.1/lib/rack/conditionalget.rb:35:in `call'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_dispatch/middleware/head.rb:14:in `call'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_dispatch/middleware/params_parser.rb:21:in `call'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_dispatch/middleware/flash.rb:242:in `call'

[GEM_ROOT]/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:in `context'

[GEM_ROOT]/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in `call'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_dispatch/middleware/cookies.rb:338:in `call'

[GEM_ROOT]/gems/activerecord-3.2.3/lib/active_record/query_cache.rb:64:in `call'

[GEM_ROOT]/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:467:in `call'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in `_run__538782405__call__894330699__callbacks'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in `__run_callback'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:81:in `run_callbacks'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_dispatch/middleware/callbacks.rb:27:in `call'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'

[GEM_ROOT]/gems/railties-3.2.3/lib/rails/rack/logger.rb:26:in `call_app'

[GEM_ROOT]/gems/railties-3.2.3/lib/rails/rack/logger.rb:16:in `call'

[GEM_ROOT]/gems/actionpack-3.2.3/lib/action_dispatch/middleware/request_id.rb:22:in `call'

[GEM_ROOT]/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'

[GEM_ROOT]/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'

[GEM_ROOT]/gems/activesupport-3.2.3/lib/active_support/cache/strategy/local_cache.rb:72:in `call'

[GEM_ROOT]/gems/rack-ssl-1.3.2/lib/rack/ssl.rb:27:in `call'

[GEM_ROOT]/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'

[GEM_ROOT]/gems/rack-cache-1.2/lib/rack/cache/context.rb:143:in `pass'

[GEM_ROOT]/gems/rack-cache-1.2/lib/rack/cache/context.rb:155:in `invalidate'

[GEM_ROOT]/gems/rack-cache-1.2/lib/rack/cache/context.rb:71:in `call!'

[GEM_ROOT]/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'

[GEM_ROOT]/gems/railties-3.2.3/lib/rails/engine.rb:479:in `call'

[GEM_ROOT]/gems/railties-3.2.3/lib/rails/application.rb:220:in `call'

[GEM_ROOT]/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'

/usr/libexec/passenger/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'

/usr/libexec/passenger/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'

/usr/libexec/passenger/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'

/usr/libexec/passenger/lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'

/usr/libexec/passenger/lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'

/usr/libexec/passenger/lib/phusion_passenger/utils.rb:479:in `safe_fork'

/usr/libexec/passenger/lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'

/usr/libexec/passenger/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'

/usr/libexec/passenger/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'

/usr/libexec/passenger/lib/phusion_passenger/abstract_server.rb:180:in `start'

/usr/libexec/passenger/lib/phusion_passenger/rack/application_spawner.rb:129:in `start'

/usr/libexec/passenger/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'

Hi Guys,

Facing a weird error .

Errno::EAFNOSUPPORT: Address family not supported by protocol - socket(2) It seems to be happening with mail sending mail . I am using AUTHSMTP to send mails . Unable to send mail and the app breaks . Any help will be appreciated . Same code worked with ruby 1.8 and rails 2.3.x .

If the problem is sending mail, why not post your actionmailer config

Fred