phpcurl 请求Chunked-Encoded data 遇到的一个问题
2016-10-21 16:51 by 轩脉刃, 105 阅读, 0 评论, 收藏, 编辑最早出现的问题情况是提供es的部门在es的外部封装了一个gateway做请求中转。
当我们转换到gateway上之后,发现了问题:
有的请求可以获取到数据,有的请求获取不到数据。
仔细分析了业务代码,抽取了一个出问题的业务请求,这个业务请求里面包含了多次对es的请求,只有最后一个es请求抛出异常,其他都正常。
ps: 我们的业务是使用php写的,使用了https://github.com/elastic/elasticsearch-php这个包进行es请求的。
初步分析
当然,我们没有把错误信息对外,首先看我们自己的日志,看到的错误信息是:
No alive nodes found in your cluster at elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/StaticNoPingConnectionPool.php:51
这个错误第一反应是是不是新的这个gateway节点有问题啊?但是想想这是不可能的,因为并不是所有请求都不可以,而且找了gateway部门的同事问了下,也不存在对请求单独处理的逻辑。
那么继续看到StaticNoPingConnectionPool.php
public function nextConnection($force = false) {
$total = count($this->connections); while ($total--) { /** @var Connection $connection */ $connection = $this->selector->select($this->connections); if ($connection->isAlive() === true) { return $connection;
} if ($this->readyToRevive($connection) ===
网友评论

