python - Tensorflow io.gfile.GFile 错误 - Curl 返回错误代码 60 - 如果签名检查失败。这可能是因为时间偏差
问题描述
我tf.io.gfile.GFile(...)
用来从符合 S3 的接口读取文件。产生此错误的代码昨天工作,今天停止工作,代码没有变化,因此可能在服务器端发生变化。
2020-05-30 11:33:01.400501: I tensorflow/core/platform/s3/aws_logging.cc:54] Setting provider to read credentials from /home/davidparks21//.aws/credentials for credentials file and /home/davidparks21//.aws/config for the config file , for use with profile default
2020-05-30 11:33:01.400526: I tensorflow/core/platform/s3/aws_logging.cc:54] Creating AWSHttpResourceClient with max connections2 and scheme http
2020-05-30 11:33:01.400538: I tensorflow/core/platform/s3/aws_logging.cc:54] Initializing CurlHandleContainer with size 2
2020-05-30 11:33:01.400551: I tensorflow/core/platform/s3/aws_logging.cc:54] Creating Instance with default EC2MetadataClient and refresh rate 300000
2020-05-30 11:33:01.400561: I tensorflow/core/platform/s3/aws_logging.cc:54] Added EC2 metadata service credentials provider to the provider chain.
2020-05-30 11:33:01.400643: I tensorflow/core/platform/s3/aws_logging.cc:54] Successfully reloaded configuration.
2020-05-30 11:33:01.400705: I tensorflow/core/platform/s3/aws_logging.cc:54] Initializing CurlHandleContainer with size 25
2020-05-30 11:33:01.401062: I tensorflow/core/platform/s3/aws_logging.cc:54] Pool grown by 2
2020-05-30 11:33:01.401081: I tensorflow/core/platform/s3/aws_logging.cc:54] Connection has been released. Continuing.
2020-05-30 11:33:01.486735: E tensorflow/core/platform/s3/aws_logging.cc:60] Curl returned error code 60
2020-05-30 11:33:01.486780: E tensorflow/core/platform/s3/aws_logging.cc:60] HTTP response code: 684960552
Exception name:
Error message: Unable to connect to endpoint
0 response headers:
2020-05-30 11:33:01.486802: W tensorflow/core/platform/s3/aws_logging.cc:57] If the signature check failed. This could be because of a time skew. Attempting to adjust the signer.
2020-05-30 11:33:01.486823: W tensorflow/core/platform/s3/aws_logging.cc:57] Request failed, now waiting 0 ms before attempting again.
2020-05-30 11:33:01.486993: I tensorflow/core/platform/s3/aws_logging.cc:54] Connection has been released. Continuing.
查看 libcurl 错误代码 60 https://curl.haxx.se/libcurl/c/libcurl-errors.html:
CURLE_PEER_FAILED_VERIFICATION (60)
The remote server's SSL certificate or SSH md5 fingerprint was deemed not OK. This error code has been unified with CURLE_SSL_CACERT since 7.62.0. Its previous value was 51.
在 TF 1.14.0 和 2.2.0-rc3 上测试
解决方案
事实证明,S3 api 兼容服务器上的证书过期,这是造成这种情况的原因。值得注意的是,似乎只有 libcurl(我们发现了 wget)可以检查这一点。其他 S3 工具之类的awscli/boto3
就不用管了。
推荐阅读
- jndi - javax.naming.exception:JNDI 查找失败 与路由器通信时出错
- matlab - 如何在 matlab 的 anfis.m 中获得训练的隶属函数范围?
- php - 为什么我不能将数据插入数据库
- html - woocomerce 中每个产品的高度相同
- python - `TypeError:一元+的错误操作数类型:'str'`
- python - 如何在实线上方绘制散点图
- swift - Swift Extension 计算变量在协议中声明之前无法正确读取
- php - PHP - 右双引号呈现菱形问号
- python - 计数 DNA PSET6 CS50 中的重复 STR
- flutter - WebSocketException上的Flutter Socket io错误:连接未升级到websocket