Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yar tcp 方式调用偶发性 empty response #110

Open
you19891003 opened this issue Aug 16, 2017 · 1 comment
Open

yar tcp 方式调用偶发性 empty response #110

you19891003 opened this issue Aug 16, 2017 · 1 comment

Comments

@you19891003
Copy link

已经是最新版本的yar了

#======php -v
PHP 7.0.17 (cli) (built: Jul 4 2017 13:47:27) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.17, Copyright (c) 1999-2017, by Zend Technologies
#======php --ri yar

yar

yar support => enabled
Version => 2.0.3

Directive => Local Value => Master Value
yar.packager => msgpack => msgpack
yar.transport => curl => curl
yar.debug => Off => Off
yar.expose_info => On => On
yar.connect_timeout => 5000 => 5000
yar.timeout => 60000 => 60000
yar.content_type => application/octet-stream => application/octet-stream
yar.allow_persistent => 1 => 1

代码:
try {
$yar = new Yar_Client(YAR_GEO_LOCATION);
$yar->setOpt(YAR_OPT_PERSISTENT, 1);
switch ($type) {
case 'ip2location':
if (!empty($ip)) {
$data = $yar->ip2location($ip);
}
break;
case 'gps2location':
if (!empty($lon) && !empty($lat)) {
$data = $yar->gps2location((float) $lat, (float) $lon);
}
break;
}
} catch (Exception $e) {
writeLog('type:' . $type . ',lon:' . $lon . ',lat:' . $lat . ',ip:' . $ip . ',msg:' . $e->getMessage(), 'yarGeoLocationError');
}

偶发性异常:
2017-08-16 18:38:37||type:ip2location,lon:,lat:,ip:112.80.1.218,msg:empty response

@laruence
Copy link
Owner

laruence commented Jan 8, 2018

empty respone也有可能是服务端crash了, 或者提前关闭了链接, 还是要具体分析下服务端的实现

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants