Lost connection to MySQL server during query

Thank you for any help you might provide. This is keeping me awake nights...

Mysql::Error in <mycontroller>#<mymethod> Lost connection to MySQL server during query RAILS_ROOT: <mypath> Application Trace c:/ruby/lib/ruby/site_ruby/1.8/mysql.rb:1116:in `write` ...

This error has come up intermittently but often for many months... It is keeping us from rolling out a RoR system. I've devoted a day a week for the past two months to try to fix it without any success. I've fiddled with:   MySQL parameters -- no effect from      High values for all timeouts   environment.rb -- no effect from      ActiveRecord::Base.connection.instance_eval        {@connection.reconnect = true}   database.yml -- no effect from       timeout: 8000       reconnect: true

The problem doesn't happen with batch programs -- only with Rails.

It happens with about one transaction in twenty.

The problem doesn't seem to correlate with database load, or idle time, or anything else.

Any ideas or suggestions? Any suggestions on how to collect good data on what's causing this?

Windows 2000 Server SP4 Apache 2.2 MySQL 5.1.32 Ruby 1.8.6    ActiveRecord 2.3.4    mysql 2.8.1