Errno::ENXIO (Device not configured) when using net/https fr

I have the following code that creates a https connection from within
a rails controller. Works fine except that if it doesn’t get called
for a few hours it starts throwing an exception until I restart rails
(apache1.3 + scgi). I wonder if something here isn’t thread safe?
Just a guess.

@postdata = nil
headers = { ‘Referer’ => ‘’, ‘Content-Type’ =>
‘application/x-www-form-urlencoded’ }
@postdata = “directauth=1&user=#{user}&pass=#{@password}”
site = Net::HTTP.new( ‘mysite.com’, 443 )
site.use_ssl = true
response = site.post(’/login’, @postdata, headers)

And this is the backtrace:

Errno::ENXIO (Device not configured):
/usr/local/lib/ruby/1.8/net/http.rb:566:in write' /usr/local/lib/ruby/1.8/net/http.rb:566:inconnect’
/usr/local/lib/ruby/1.8/net/http.rb:555:in do_start' /usr/local/lib/ruby/1.8/net/http.rb:544:instart’
/usr/local/lib/ruby/1.8/net/http.rb:1031:in request' /usr/local/lib/ruby/1.8/net/http.rb:840:inpost’
/app/controllers/application.rb:69:in authorize' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/filters.rb:399:incall_filters’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/filters.rb:394:in
call_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/filters.rb:383:inbefore_action’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/filters.rb:365:in
perform_action_without_benchmark' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
/usr/local/lib/ruby/1.8/benchmark.rb:293:in measure' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/rescue.rb:82:in
perform_action' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/base.rb:381:inprocess_without_filters’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/filters.rb:377:in
process_without_session_management_support' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/session_management.rb:117:inprocess’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/dispatcher.rb:38:in
dispatch' /usr/local/lib/ruby/gems/1.8/gems/scgi_rails-0.4.3/bin/scgi_service:23:inprocess_request’
/usr/local/lib/ruby/1.8/thread.rb:135:in synchronize' /usr/local/lib/ruby/gems/1.8/gems/scgi_rails-0.4.3/bin/scgi_service:21:inprocess_request’
/usr/local/lib/ruby/gems/1.8/gems/scgi_rails-0.4.3/lib/scgi.rb:291:in
read_header' /usr/local/lib/ruby/gems/1.8/gems/scgi_rails-0.4.3/lib/scgi.rb:253:inhandle_client’
/usr/local/lib/ruby/gems/1.8/gems/scgi_rails-0.4.3/lib/scgi.rb:234:in
handle_client' /usr/local/lib/ruby/gems/1.8/gems/scgi_rails-0.4.3/lib/scgi.rb:188:inlisten’
/usr/local/lib/ruby/gems/1.8/gems/scgi_rails-0.4.3/lib/scgi.rb:186:in
listen' /usr/local/lib/ruby/gems/1.8/gems/scgi_rails-0.4.3/lib/scgi.rb:412:inrun’
/usr/local/lib/ruby/gems/1.8/gems/scgi_rails-0.4.3/bin/scgi_service:61

Also, this is on Freebsd 6.1, and line 68 of the authorize method is
site.post being called.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs