walkor / workerman

An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols.
http://www.workerman.net
MIT License
11.06k stars 2.26k forks source link

About too many connections error of mysql #186

Closed cnsms closed 7 years ago

cnsms commented 7 years ago

6个客户端每分钟发来一次数据。大约一二十分钟后服务端就报错了。 1 2 3

cnsms commented 7 years ago

2017-07-04 19:25:15 exception 'PDOException' with message 'SQLSTATE[08004] [1040] Too many connections' in C:\www\zk\thinkphp\library\think\db\Connection.php:300 Stack trace:

0 C:\www\zk\thinkphp\library\think\db\Connection.php(300): PDO->__construct('mysql:dbname=do...', 'root', 'root', Array)

1 C:\www\zk\thinkphp\library\think\db\Connection.php(934): think\db\Connection->connect()

2 C:\www\zk\thinkphp\library\think\db\Connection.php(414): think\db\Connection->initConnect(true)

3 C:\www\zk\thinkphp\library\think\db\Query.php(239): think\db\Connection->execute('INSERT INTO `sy...', Array)

4 C:\www\zk\thinkphp\library\think\db\Query.php(2063): think\db\Query->execute('INSERT INTO `sy...', Array)

5 C:\www\zk\application\workerman\model\Device.php(126): think\db\Query->insert(Array)

6 C:\www\zk\application\workerman\controller\Index.php(91): app\workerman\model\Device->abnormal(22, Array)

7 [internal function]: app\workerman\controller\Index->app\workerman\controller{closure}(Object(Workerman\Connection\TcpConnection), '\xFF\xAA\x16\x00\\x00000000000...')

8 C:\www\zk\Workerman\Connection\TcpConnection.php(503): call_user_func(Object(Closure), Object(Workerman\Connection\TcpConnection), '\xFF\xAA\x16\x00\\x00000000000...')

9 [internal function]: Workerman\Connection\TcpConnection->baseRead(Resource id #84)

10 C:\www\zk\Workerman\Events\Select.php(257): call_user_func_array(Array, Array)

11 C:\www\zk\Workerman\Worker.php(809): Workerman\Events\Select->loop()

12 C:\www\zk\Workerman\Worker.php(457): Workerman\Worker->run()

13 C:\www\zk\Workerman\Worker.php(366): Workerman\Worker::runAllWorkers()

14 C:\www\zk\application\workerman\controller\Index.php(126): Workerman\Worker::runAll()

15 [internal function]: app\workerman\controller\Index->index()

16 C:\www\zk\thinkphp\library\think\App.php(224): ReflectionMethod->invokeArgs(Object(app\workerman\controller\Index), Array)

17 C:\www\zk\thinkphp\library\think\App.php(389): think\App::invokeMethod(Array, Array)

18 C:\www\zk\thinkphp\library\think\App.php(130): think\App::module(Array, Array, NULL)

19 C:\www\zk\thinkphp\start.php(18): think\App::run()

20 C:\www\zk\index.php(32): require('C:\www\zk\think...')

21 {main}

walkor commented 7 years ago

Please use english, that can help all people to understand each other. Thanks. : -)

walkor commented 7 years ago

Refer #187 .