diff options
-rw-r--r-- | activerecord/lib/active_record/vendor/mysql.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/vendor/mysql.rb b/activerecord/lib/active_record/vendor/mysql.rb index 85ded2bc94..1c3294c719 100644 --- a/activerecord/lib/active_record/vendor/mysql.rb +++ b/activerecord/lib/active_record/vendor/mysql.rb @@ -1174,7 +1174,11 @@ class << Mysql def finalizer(net) proc { net.clear - net.write Mysql::COM_QUIT.chr + begin + net.write(Mysql::COM_QUIT.chr) + net.close + rescue # Ignore IOError if socket is already closed. + end } end |