I just setup Rails on Centos5. I have a remote MySQL 4.1 server.
I am able to successfully connect to MySQL with rails and it works
fine
most of the time.
However, I get the following error every once in a while (not always
on
the same query):
Mysql::Error: Lost connection to MySQL server during query: SHOW
FIELDS
FROM groups_rights
Does this happen after long periods of inactivity? Have you tried
setting config.active_record.verification_timeout
You need to set it to something lower than whatever your mysql
connection timeout setting is.
For the fun of it I installed MySQL 5 on the same server that rails is
on and I can duplicate this problem. This is feeling like a problem
with the mysql-ruby stuff, doesn't it?
Any suggestion on how to proceed on troubleshooting?
Thanks Fred - I'll try that out a little later (have a meeting in a min)
- but one more clue:
This is only happening when using the active_record_store to store
sessions. I canno duplicate when writing session info to file.
I can see in the SQL log that "sometimes" when it does the query to
update the session it creates a new connection to the db (as opposesed
to using the connection that rails process has already created - that is
when the error occurs.
Most of the time the session query is using the same connection as the
rest of the queries.
Thought I'd post that bit of information in the event it rings a bell
for anyone.
Maybe there's some clues in your mysql error log? There may be
something wrong with the table. I've gotten similar behavior to this
once when I redefined the size of the innodb data files.
Maybe there's some clues in your mysql error log? There may be
something wrong with the table. I've gotten similar behavior to this
once when I redefined the size of the innodb data files.
Actually, you can just check the development.log to see if you are
using the correct bindings. If not you'll get this:
WARNING: You're using the Ruby-based MySQL library that ships with
Rails. This library is not suited for production. Please install the
C-
based MySQL library instead (gem install mysql).
Interestingly I have done 'gem install mysql' and I still get this
warning.