$data = curl_exec($curl);
$errno = curl_errno($curl);
//本地curl配置的超时时间较长(大于接口超时时间),且curl返回的504,curl_errno函数返回0 CURLE_OK
Hprose/Http/Client.php默认超时时间为30s,下游接口15s返回504超时,在getContents函数中检测http code,造成php error日志记录504超时错误
vendor/hprose/hprose/src/Hprose/Http/Client.php
Hprose\Http\Client->getContents(’\r\n<…’, Object(stdClass))
vendor/hprose/hprose/src/Hprose/Http/Client.php
Hprose\Http\Client->syncSendAndReceive(‘Cs15"GetFieldsB…’, Object(stdClass))
vendor/hprose/hprose/src/Hprose/Client.php
Hprose\Http\Client->sendAndReceive(‘Cs15"GetFieldsB…’, Object(stdClass))
vendor/hprose/hprose/src/Hprose/Client.php
Hprose\Client->afterFilterHandler(‘Cs15"GetFieldsB…’, Object(stdClass))
探讨了Hprose/Http/Client.php中因下游接口响应超时导致的504错误,分析了超时时间设置与错误处理机制,涉及curl配置、httpcode检测及phperror日志记录。
3767

被折叠的 条评论
为什么被折叠?



