A job on the queue is giving a timeout for a very simple select query.
The project is using Laravel 7.4 with Mysql 5.7 and Doctrine 2.10.1.
The error is:
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
When retrying the job it fails again.
When using Laravel and Doctrine, sometimes the queue workers lose their database connection.
php artisan queue:restart should fix the problem right away.
Related
I have just updated an Laravel project from Laravel version 5.4 to 5.5. After upgrading I am getting error where the error message is:
Line: 2445
File: /home/vagrant/Projects/Media365/harlib-core/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php
Call to undefined method Illuminate\Database\Query\Builder::newQueryForRestoration()
I have no clue why I am getting this error. Even there is nothing but only comment at line 244Illuminate/Database/Query/Builder.php file.
If this error is caused from a queued job and you're using supervisor to run the queue worker then I was having the same problem. I was running the queue worker on supervisor before I upgraded to 5.5 from 5.4. Supervisor keeps the old version and you need to restart it:
supervisorctl restart <program_name>
In some case I have this exception, I'am using Amazon server, and amazon RBS DB mysql db service. I can not resolve issue, because it throws only sometimes.
Finally I solved my issue. When my process starting it adding another process to queue and that process never ended. Now I add all that part in try catch block, and when catching mysql error I start mysql process.
I know this question has been asked on here before, but it seems like I've tried everything suggested in this answer and this answer, and still no luck. I'm trying to use MySQL Workbench 6.3 on a Windows 10 client, connecting to a Linux MySQL server hosted by GoDaddy/cPanel.
I can connect to the MySQL server with no problems, and usually I have time to run a query or two. Then, within a minute of inactivity between Workbench and the server, I'll run into Error 2013: Lost connection to MySQL server during query. This even happens when running the exact same query, back to back about a minute apart, as shown here (even when the original query is quick; only 0.03 seconds to run):
The same problem persists when I run select sleep(60) immediately upon connecting to the MySQL Server; the connection is usually lost between 30-40 seconds into the execution of the query:
I've checked the MySQL docs, but with no luck. I don't think the problem can be related to packet size, as others have suggested (since the same query will work and then fail later), and my Workbench timeout settings look okay:
Anyone have any idea? The only other thing I can think of is maybe the wait_timeout variable listed in the MySQL docs needs to be increased too, but I guess that would be somewhere on the server side (some have mention my.ini) and I can't find where any MySQL Server files live in the cPanel hosting admin interface. There's a MySQL online client provided through cPanel (phpMyAdmin I think), but it's not nearly as robust and is becoming cumbersome to use. Any help would be appreciated!
I was having the same problem, using MySQL Workbench 6.3.6 on Win10 to connect to a MySQL server on a shared hosting system (Arvixe).
In addition to to the problem described by the OP (lost connection to server), I was also getting an error when attempting to import data from a prior export (similar to what is described here):
Unhandled exception: Error querying security information: Error executing 'SELECT * FROM mysql.user WHERE user = '[username]' and Host = '[host]' ORDER BY User, Host' SELECT command denied to user '[username]'#'[host]' for table 'user' SQL Error: 1142
Apparently, a bug was introduced in MySQL Workbench 6.3.5 (bug report). From the bug report:
It appears the problem arise if connecting with an user with no privileges on the mysql schema.
In other words: users connecting to a shared hosting system.
The proposed solution is to uninstall MySQL Workbench 6.3.6, and install 6.3.4 instead. (6.3.4 can be found in the archives). This solution worked for me.
I have successfully got Seafile Server fully working with HTTPS.
However I'm trying to migrate from SQLite to MySQL and everytime I try, the seafile server stops working.
I'm not sure what information to put here that yous will need but happy to provide what ever you need.
I followed this guide Deploy Seafile Windows Server With MySQL
Its really frustrating, I dont understand why its not working. I also installed MySQL Workbench and I can see the seafile user with privileges and the databases populated with the tables.
Are there any messages in the logs?
Please look at the logs in /seafile/logs/
You will see an error message in seafile.log if you have problems with MySQL.
For example:
../common/seaf-db.c(123): Failed to get database connection:
Failed to connect to MySQL: Can't connect to MySQL server on '127.0.0.1' (107).
http-server.c(761): DB error when check repo existence.
Disconnected from daemon
I have done such migration already and it did work without problems.
My web threw the error "MySQL server has gone away". I google it, find a method that use mysql_ping function, but I use extension mysqli, not mysql.
How can I fix this problem?
There is a mysqli_ping method for this, as well:
http://us3.php.net/manual/en/mysqli.ping.php
However, in my experience, ping was not needed. All I had to do was add mysqli.reconnect = "1" to my php.ini.
Ref. check if mysql connection is valid
You may get this error when your query is crashing MySQL server check MySQL error log file for that.
If values for wait_timeout & interactive_timeout MySQL server variables is set to very low in MySQL configuration file. Try increasing values for them and then restart MySQL server.
This is basically a time between two queries and after opening new connection if you don't execute next query before this timeout then your connection will be automatically closed by the MySQL server and you will get this error.
Stop and start mysql server to fix this problem.