Hi everyone,
Hopefully this is the right place to report this issue. If not, please
direct me to the right audience.
I''ve run into a bug in ActiveRecord 1.14.4 which occurs under the
following conditions:
1) The MySQL adapter is used
2) MySQL is configured for SSL, and requires connections to be
encrypted with SSL
3) A database connection is made, then left idle until it disconnects
(on my system, the CLOSE_WAIT_TIMEOUT is 10 minutes)
4) After the database connection has timed out, load a Rails page
When you try to load a Rails page, ActiveRecord automatically tries to
reconnect, but then runs into Access Denied errors (as reported in the
log files). This then raises an error, and a 500 error is displayed.
I resolved this issue with the following one-liner (the file in
question is
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_adapter.rb):
(%:/tmp) diff -u mysql_adapter.rb.orig mysql_adapter.rb
--- mysql_adapter.rb.orig 2007-01-04 17:08:12.734873750 -0800
+++ mysql_adapter.rb 2007-01-04 17:08:01.294158750 -0800
@@ -327,6 +327,7 @@
if encoding
@connection.options(Mysql::SET_CHARSET_NAME, encoding)
rescue nil
end
+ @connection.ssl_set(@config[:sslkey], @config[:sslcert],
@config[:sslca], @config[:sslcapath], @config[:sslcipher]) if
@config[:sslkey]
@connection.real_connect(*@connection_options)
execute("SET NAMES ''#{encoding}''") if
encoding
end
For some reason, it looks like the SSL settings made in the initial
connection are lost. I''m not completely convinced this is the right
solution to the problem (finding out why the settings are lost sounds
better), but this works as a stop-gap solution. Hopefully the right
person will see this and be able to fix this.
Please let me know if you''d like any additional details on this
problem, or if there''s anything I can do to help resolve this bug.
Thanks,
Randy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---