Can't shift from an empty datastructure

madao708

使用react/mysql 连接数据库时,一直报这个错误

Fatal error: Uncaught exception 'RuntimeException' with message 'Can't shift from an empty datastructure' in /data/web/socket/Workerman/vendor/react/mysql/src/Protocal/Parser.php:289
Stack trace:
#0 /data/web/socket/Workerman/vendor/react/mysql/src/Protocal/Parser.php(289): SplQueue->dequeue()
#1 /data/web/socket/Workerman/vendor/react/mysql/src/Protocal/Parser.php(195): React\MySQL\Protocal\Parser->onError()
#2 : React\MySQL\Protocal\Parser->parse('???????#28000ip...', Object(React\Socket\Connection))
#3 /data/web/socket/Workerman/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(65): call_user_func_array(Array, Array)
#4 /data/web/socket/Workerman/vendor/react/stream/src/Stream.php(173): Evenement\EventEmitter->emit('data', Array)
#5 : React\Stream\Stream->handleData(Resource id #964, Object(Workerman\Events\React\LibEventLoop))
#6 /data/web/socket/Workerman/vendor/react/event-loop/src/LibEventLoop.php(335): call_user_func(Array, Resource id #964, Object(Workerman\Event in /data/web/socket/Workerman/vendor/react/mysql/src/Protocal/Parser.php on line 289
4007 2 0
2个回答

madao708
connect success
connect success
error:exception 'React\Dns\Query\TimeoutException' with message 'DNS query for rdsnj89413011s6jfl62.mysql.rds.aliyuncs.com timed out' in /data/web/socket/Workerman/vendor/react/dns/src/Query/Executor.php:69
Stack trace:
#0 : React\Dns\Query\Executor->React\Dns\Query\{closure}(Object(React\EventLoop\Timer\Timer))
#1 /data/web/socket/Workerman/vendor/react/event-loop/src/LibEventLoop.php(302): call_user_func(Object(Closure), Object(React\EventLoop\Timer\Timer))
#2 : React\EventLoop\LibEventLoop->React\EventLoop\{closure}(NULL, 1, Object(React\EventLoop\Timer\Timer))
#3 /data/web/socket/Workerman/vendor/react/event-loop/src/LibEventLoop.php(211): event_base_loop(Resource id #36, 1)
#4 /data/web/socket/Workerman/Events/React.php(122): React\EventLoop\LibEventLoop->run()
#5 /data/web/socket/Workerman/Worker.php(1537): Workerman\Events\React->loop()
#6 /data/web/socket/Workerman/Worker.php(936): Workerman\Worker->run()
#7 /data/web/socket/Workerman/Worker.php(899): Workerman\Worker::forkOneWorker(Object(Workerman\Worker))
#8 /data/web/socket/Workerman/Worker.php(431): Workerman\Worker::forkWorkers()
#9 /data/web/socket/testBeat.php(157): Workerman\Worker::runAll()
#10 {main}

Next exception 'RuntimeException' with message 'DNS query for rdsnj89413011s6jfl62.mysql.rds.aliyuncs.com failed: too many retries' in /data/web/socket/Workerman/vendor/react/dns/src/Query/RetryExecutor.php:31
Stack trace:
#0 /data/web/socket/Workerman/vendor/react/promise/src/RejectedPromise.php(25): React\Dns\Query\RetryExecutor->React\Dns\Query\{closure}(Object(React\Dns\Query\TimeoutException))
#1 /data/web/socket/Workerman/vendor/react/promise/src/Promise.php(119): React\Promise\RejectedPromise->then(NULL, Object(Closure))
#2 /data/web/socket/Workerman/vendor/react/promise/src/Promise.php(174): React\Promise\Promise->React\Promise\{closure}(Object(React\Promise\RejectedPromise))
#3 /data/web/socket/Workerman/vendor/react/promise/src/Promise.php(142): React\Promise\Promise->settle(Object(React\Promise\RejectedPromise))
#4 /data/web/socket/Workerman/vendor/react/promise/src/Promise.php(195): React\Promise\Promise->reject(Object(React\Dns\Query\TimeoutException))
#5 : React\Promise\Promise->React\Promise\{closure}(Object(React\Dns\Query\TimeoutException))
#6 /data/web/socket/Workerman/vendor/react/promise/src/Deferred.php(42): call_user_func(Object(Closure), Object(React\Dns\Query\TimeoutException))
#7 /data/web/socket/Workerman/vendor/react/dns/src/Query/Executor.php(69): React\Promise\Deferred->reject(Object(React\Dns\Query\TimeoutException))
#8 : React\Dns\Query\Executor->React\Dns\Query\{closure}(Object(React\EventLoop\Timer\Timer))
#9 /data/web/socket/Workerman/vendor/react/event-loop/src/LibEventLoop.php(302): call_user_func(Object(Closure), Object(React\EventLoop\Timer\Timer))
#10 : React\EventLoop\LibEventLoop->React\EventLoop\{closure}(NULL, 1, Object(React\EventLoop\Timer\Timer))
#11 /data/web/socket/Workerman/vendor/react/event-loop/src/LibEventLoop.php(211): event_base_loop(Resource id #36, 1)
#12 /data/web/socket/Workerman/Events/React.php(122): React\EventLoop\LibEventLoop->run(
  • 暂无评论
walkor 打赏
$worker->onWorkerStart = function() {
    global   $dns;
    $loop    = Worker::getEventLoop();
    $factory = new React\Dns\Resolver\Factory();
    $dns     = $factory->create('8.8.8.8', $loop);
};

把8.8.8.8 换成阿里云内网dns服务器地址。

如果React\Dns不太会用的话,可以用ip来连数据库,不要用域名。

  • 暂无评论
年代过于久远,无法发表回答
×
🔝