Mysql2::Error: Lost connection to MySQL server during query
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
This will create the necessary database tables and seed the database.
You will lose any previous data stored in the database.
Do you want to continue (yes/no)? yes
gitlabhq_production already exists
-- enable_extension("plpgsql")
-> 0.0013s
bla bla bla
-- add_index("namespaces", ["type"], {:name=>"index_namespaces_on_type", :using=>:btree})
-> 0.2003s
-- create_table("notes", {:force=>true})
rake aborted!
Mysql2::Error: Lost connection to MySQL server during query: CREATE TABLE `notes` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `note` text, `noteable_type` varchar(255), `author_id` int(11), `created_at` datetime, `updated_at` datetime, `project_id` int(11), `attachment` varchar(255), `line_code` varchar(255), `commit_id` varchar(255), `noteable_id` int(11), `system` tinyint(1) DEFAULT 0 NOT NULL, `st_diff` text) ENGINE=InnoDB
/home/git/gitlab/vendor/bundle/ruby/2.0.0
bla bla bla
/gems/activerecord-4.0.3/lib/active_record/railties/databases.rake:260:in `block (3 levels) in <top (required)>'
/home/git/gitlab/lib/tasks/gitlab/setup.rake:17:in `setup_db'
/home/git/gitlab/lib/tasks/gitlab/setup.rake:4:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:schema:load
(See full trace by running task with --trace)
[root@michaels gitlab]#
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:
Uncomment innodb_log_file_size and change from 8M to 1G
Uncomment innodb-buffer-pool-size and change from 128M to 4G
Change max-allowed-packet from 16M to 32M
What could be the cause, and how can I troubleshoot it?
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'?
I successfully did this same install on another server, so it should work with MySQL. To the best of my knowledge, I've followed https://github.com/gitlabhq/gitlab-r...install/centos exactly, and skipped the steps regarding postgres.
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
I've tried starting the install process over, but had the same results. Could there be any configuration that I need to manually remove? I would rather not rebuild the entire server just really start over.
What I've read about the "Lost connection to MySQL server during query" error is it might be memory related.
That just means you are in a detached HEAD mode... explanation in the warning:
Quote:
git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.9.1
Cloning into 'gitlab-shell'...
:blah:
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
Do you have a moment to show the versions that you are using here? of git, mysql, ruby,.. any other requirements? Or are you certain that you are meeting the requirements?
Last edited by szboardstretcher; 03-27-2014 at 11:43 AM.
Do you have a moment to show the versions that you are using here? of git, mysql, ruby,.. any other requirements? Or are you certain that you are meeting the requirements?
I think you are on to something!!!! git is only 1.7.1. I am going to post a new question about this. Hopefully, this is the problem. Thank you!
There are three likely causes for this error message.
Usually it indicates network connectivity trouble and you should check the condition of your network if this error occurs frequently. If the error message includes “during query,” this is probably the case you are experiencing.
I will look into the git version before proceeding with this.
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.
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:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 30
Server version: 5.5.36 Distributed by The IUS Community Project
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> exit
Bye
[root@michaels gitlab]# git --version
git version 1.8.3.1
[root@michaels gitlab]# ruby -v
ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-linux]
[root@michaels gitlab]#
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.
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.
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…
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.