Mysql2::Error: Lost connection to MySQL server during query
I am at my wits end! I am receiving the following error:
Code:
[root@michaels gitlab]# sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production I am using mysql55.x86_64 , 5.5.36-1.ius.centos6. I've tried modifing /etc/my.cnf as follows, but it produces no change:
What could be the cause, and how can I troubleshoot it? Thank you |
First of all,.. Gitlab reccomends using postgres. Not sure how useful this program will be without it.
Quote:
https://github.com/gitlabhq/gitlabhq...nstallation.md https://github.com/gitlabhq/gitlabhq...abase_mysql.md Have you followed all the steps in those guides? Including the part that says 'skip this if you dont want to use postgres, and use mysql instead'? |
Quote:
I see what you are talking about regarding '-- enable_extension("plpgsql")'. I don't recall whether this came up on the other server successful install. Before executing the command which results in an error, I executed the following which should not use postgres. Code:
sudo -u git -H /usr/local/bin/bundle install --deployment --without development test postgres aws What I've read about the "Lost connection to MySQL server during query" error is it might be memory related. Any suggestions would be very appreciated. Thank you |
Could this be related?
Code:
[root@michaels git]# sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.9.1 |
That just means you are in a detached HEAD mode... explanation in the warning:
Quote:
|
Quote:
On a side note, per https://dev.mysql.com/doc/refman/5.0...onnection.html Quote:
|
Np. If you are using an old ruby version with an old gem, that might explain the mysql stuff. I would suggest following the guide and upgrading Ruby to 2.0.x and Git to 1.7.10+ where needed.
|
Ugg!
I deleted the git user (and its home directory) and the database and started over. Still the same errors. Sometimes I get "rake aborted! Errno::EBADF: Bad file descriptor: SHOW TABLES LIKE 'projects'", but mostly it is the "Lost connection to MySQL server during query" error In regards to versions of MySQL, Ruby, and git, I should be fine on all of them. Could it be a network issue as the link I posted to mysql suggested? How could I troubleshoot it. Thank you Code:
[root@michaels gitlab]# mysql -u root -p Enter password: |
http://omegadelta.net/2014/03/15/the-rails-grim-reaper/
I ended up solving the problem by commenting out "reaping_frequency: 10" in /home/git/config/database.yml. Why this solved the issue, I am still not 100% certain. Thanks for your help |
Hey, I'm glad my blog post was helpful :)
The "reaper" is meant to remove "dead" connections but it seems to be very buggy and removes live ones too. The reaper setting is default OFF in rails now (the rails team made that change due to bugs like the ones we're having), but it looks like a bunch of sites like Heroku copied some config from when it was default ON. Really unless you are having problems with dead/leaking connections, you don't need the reaper – it's a really bad setting. And if you *are* having issues, then there must be a better way to solve them than enabling the reaper. |
Thanks divzero,
Yes your blog was very helpful! Amazing how difficult it was to find this solution. I was changing buffer sizes, etc, etc in mysql configuration. The buggyness (if that is a word) appears to even be dependent upon hardware. |
NotionCommotion, you're welcome :) Yeah I know the feeling, because most of the debugging advice for that error message are generic MySQL tips, I ended up tweaking at least a dozen config variables for MySQL with no luck. Only when I found a rails-specific reference to this error message did the penny drop.
I rolled out the fix a while ago, and the server has been running fine since so I'm confident that was the issue. Out of curiosity, why did you have the reaper enabled? For me, it was due to following some Heroku docs. |
Quote:
I will not soon forgot about the reaper. Thanks again. |
Quote:
I'm going to contact Heroku and petition them to change their recommendations, I suggest you do the same with gitlab. I'm actually surprised more people are not encountering this issue… |
All times are GMT -5. The time now is 10:08 PM. |