Mysql:中止连接.../...(读取通信数据包时出错)

Dav*_*vid 5 mysql innodb memory mysql-5.7

该错误信息已在本论坛多次提交。

我已尝试以下操作但没有成功。

语境

这是一个 Symfony1/Doctrine1 Web 应用程序。该错误出现在我的计算机和服务器上(均在 Ubuntu 上)。在浏览器级别(Chrome)我遇到错误:

POST http://*****/administration_dev.php/utilisateur net::ERR_EMPTY_RESPONSE
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

这是我的计算机详细信息:

$ uname -a
Linux Bureau 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"
$ dpkg -l |grep php
ii  libapache2-mod-php                          1:7.0+35ubuntu6                                             all          server-side, HTML-embedded scripting language (Apache 2 module) (default)
ii  libapache2-mod-php7.0                       7.0.4-7ubuntu2.1                                            amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php                                         1:7.0+35ubuntu6                                             all          server-side, HTML-embedded scripting language (default)
.../...
$ dpkg -l |grep mysql-
ii  mysql-client-5.7                            5.7.13-0ubuntu0.16.04.2                                     amd64        MySQL database client binaries
ii  mysql-client-core-5.7                       5.7.13-0ubuntu0.16.04.2                                     amd64        MySQL database core client binaries
ii  mysql-common                                5.7.13-0ubuntu0.16.04.2                                     all          MySQL database common files, e.g. /etc/mysql/my.cnf
ii  mysql-server                                5.7.13-0ubuntu0.16.04.2                                     all          MySQL database server (metapackage depending on the latest version)
ii  mysql-server-5.7                            5.7.13-0ubuntu0.16.04.2                                     amd64        MySQL database server binaries and system database setup
ii  mysql-server-core-5.7                       5.7.13-0ubuntu0.16.04.2                                     amd64        MySQL database server binaries
Run Code Online (Sandbox Code Playgroud)

当我尝试在保存过程中创建新用户时出现错误。

尝试过的提议

#1 MySQL 读取通信数据包时出错

$ mysql -uroot -p -e "SET GLOBAL max_allowed_packet = 1024 * 1024 * 1024;"
Enter password: 
$ mysql -uroot -p -e "SHOW VARIABLES LIKE 'max_allowed_packet';"
Enter password: 
+--------------------+------------+
| Variable_name      | Value      |
+--------------------+------------+
| max_allowed_packet | 1073741824 |
+--------------------+------------+
$ tail -f -n0 /var/log/mysql/error.log
2016-07-24T19:41:32.736817Z 23 [Note] Aborted connection 23 to db: 'pfs2' user: 'pfs2' host: 'localhost' (Got an error reading communication packets)
2016-07-24T19:41:32.906433Z 24 [Note] Aborted connection 24 to db: 'pfs2' user: 'pfs2' host: 'localhost' (Got an error reading communication packets)
2016-07-24T19:41:33.056226Z 25 [Note] Aborted connection 25 to db: 'pfs2' user: 'pfs2' host: 'localhost' (Got an error reading communication packets)
2016-07-24T19:41:33.212496Z 26 [Note] Aborted connection 26 to db: 'pfs2' user: 'pfs2' host: 'localhost' (Got an error reading communication packets)
2016-07-24T19:41:33.363754Z 27 [Note] Aborted connection 27 to db: 'pfs2' user: 'pfs2' host: 'localhost' (Got an error reading communication packets)
2016-07-24T19:41:33.516194Z 28 [Note] Aborted connection 28 to db: 'pfs2' user: 'pfs2' host: 'localhost' (Got an error reading communication packets)
2016-07-24T19:41:33.668201Z 29 [Note] Aborted connection 29 to db: 'pfs2' user: 'pfs2' host: 'localhost' (Got an error reading communication packets)
Run Code Online (Sandbox Code Playgroud)

#2 MySQL:读取通信数据包时出错

$ cat /etc/mysql/conf.d/david.cnf 
[mysqld]
sql-mode=NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
max_allowed_packet = 256M
innodb_log_buffer_size = 32M
innodb_log_file_size = 2047M
$ mysql -uroot -p -e "SET GLOBAL innodb_fast_shutdown = 0;"
$ sudo service mysql stop
$ sudo mv /var/lib/mysql/ib_logfile0 /var/lib/mysql/ib_logfile0.bak
$ sudo mv /var/lib/mysql/ib_logfile1 /var/lib/mysql/ib_logfile1.bak
$ sudo service mysql start
$ tail -f -n0 /var/log/mysql/error.log
2016-07-24T19:56:02.342912Z 7 [Note] Aborted connection 7 to db: 'pfs2' user: 'pfs2' host: 'localhost' (Got an error reading communication packets)
2016-07-24T19:56:02.494024Z 8 [Note] Aborted connection 8 to db: 'pfs2' user: 'pfs2' host: 'localhost' (Got an error reading communication packets)
2016-07-24T19:56:02.642960Z 9 [Note] Aborted connection 9 to db: 'pfs2' user: 'pfs2' host: 'localhost' (Got an error reading communication packets)
2016-07-24T19:56:02.787908Z 10 [Note] Aborted connection 10 to db: 'pfs2' user: 'pfs2' host: 'localhost' (Got an error reading communication packets)
2016-07-24T19:56:02.933718Z 11 [Note] Aborted connection 11 to db: 'pfs2' user: 'pfs2' host: 'localhost' (Got an error reading communication packets)
2016-07-24T19:56:03.084066Z 12 [Note] Aborted connection 12 to db: 'pfs2' user: 'pfs2' host: 'localhost' (Got an error reading communication packets)
2016-07-24T19:56:03.235319Z 13 [Note] Aborted connection 13 to db: 'pfs2' user: 'pfs2' host: 'localhost' (Got an error reading communication packets)
Run Code Online (Sandbox Code Playgroud)

我的想法和建议已经用完了,所以我在这里寻求帮助。

感谢您的支持,如果您需要的话,我会为您提供更多信息。

大卫。

Dav*_*vid 1

解决方案就在代码中。似乎 PHP 异常没有得到处理,并且应用程序在关闭打开的 sql 事务之前崩溃了。

mysql的错误信息可能就是源于这种不舒服的状态,我不能多说。

罗兰多,感谢您抽出时间。