Comments (8)
mark一下
from wechatpay-apache-httpclient.
@SnailOfLife 能贴一下你设置RetryHandler部分的代码吗
from wechatpay-apache-httpclient.
@SnailOfLife 能贴一下你设置RetryHandler部分的代码吗
你好,我之前也遇到这个问题,业务场景是发生在,微信支付完成后,立马去做查询操作,此时微信如果在处理中,会返回IO异常,IO异常会自动被org.apache.http.impl.execchain的RetryExec捕获并做重试操作,但是由于第一遍请求时,org.apache.http.impl.execchain里的ProtocolExec中,将uri置空了,所以SignatureExec中,request.getURI().getHost().endsWith(".mch.weixin.qq.com")就会报空指针异常。
from wechatpay-apache-httpclient.
@ccf0411 你好,没太明白具体的场景,还需要你提供更详细的说明
业务场景是发生在,微信支付完成后,立马去做查询操作,此时微信如果在处理中,会返回IO异常
是异步接口?是哪个接口出现的?前面的“完成”是指请求已经发送并收到了微信支付的应答吗?
from wechatpay-apache-httpclient.
@ccf0411 你好,没太明白具体的场景,还需要你提供更详细的说明
业务场景是发生在,微信支付完成后,立马去做查询操作,此时微信如果在处理中,会返回IO异常
是异步接口?是哪个接口出现的?前面的“完成”是指请求已经发送并收到了微信支付的应答吗?
我是复用连接的时候,连接已失效导致抛出 NoHttpResponseException。这个时候通过httpclient重试机制时用到的。由于默认的重试机制问题,只有在get的时候遇到这个bug,也就是查询操作。
from wechatpay-apache-httpclient.
@SnailOfLife 能贴一下你设置RetryHandler部分的代码吗
httpClient = builder
.setKeepAliveStrategy(myStrategy)
.evictExpiredConnections()
.setRetryHandler(new MyStandardHttpRequestRetryHandler(3,false))
.setDefaultRequestConfig(defRequestConfig).build();
其中MyStandardHttpRequestRetryHandler 是模仿 StandardHttpRequestRetryHandler 添加 this.idempotentMethods.put("POST", Boolean.TRUE);
但是在正常情况下是复现不出来这个问题的。我调试的时候是将请求超时时间设置为1ms,并重写HttpRequestRetryHandler 中retryRequest 方法始终返回true。才复现了此问题。
线上是因为采用连接池管理复用连接。当选取一个使用过的连接时,有可能已断开抛出NoHttpResponseException 而导致重试的。这个问题只在新的微信分中遇到过。
from wechatpay-apache-httpclient.
String host = request.getURI().getHost();
if(host==null){
host = request.getTarget().toHostString();
}
if (host.endsWith(".mch.weixin.qq.com")) {
return executeWithSignature(route, request, context, execAware);
} else {
return mainExec.execute(route, request, context, execAware);
}
这样改是个办法。
我来重现下,尽快修复这里。确实是个隐患,非常感谢 @SnailOfLife @ccf0411 提供信息。
from wechatpay-apache-httpclient.
@xy-peng 请问下,bug修复了吗
from wechatpay-apache-httpclient.
Related Issues (20)
- 支付回调验签报错 HOT 2
- 使用时Verifier没有办法初始化在springboot中 HOT 2
- 吊毛写的什么够吧文档
- 下单按照文档的格式写,遇到报错:Http头Authorization值格式错误,请参考《微信支付商户REST API签名规则》 HOT 2
- 是否考虑做个wechatpay-apache-httpasyncclient或支持异步通讯
- 视频上传问题 HOT 2
- jackson版本过低不兼容wechatpay-apache-httpclient0.4.9 HOT 1
- NotificationHandlerTest.java示例可能不够清晰 HOT 1
- prepay 提交 PrepayRequest 提示sub_mch_id HOT 1
- 证书自动更新里面写死的证书接口地址,内网服务器无法访问 HOT 1
- Caused by: java.util.concurrent.CancellationException: Operation aborted HOT 1
- 奇怪bug复现 HOT 3
- 使用该 sdk 后使用国标加密报错 HOT 2
- 接入APIV3获取证书 HOT 33
- 使用Notification对象验签之后 lombok的@Slf4j注解生成的log对象无法打印任何日志 HOT 1
- API_v3定时更新证书功能 HOT 2
- 能对接一下那个v3 Native支付问题吗
- 你好,请问下为啥一直是验签失败呢,参数都按照文档配置了
- 上传图片的uri错误了
- [BUG] 下载平台证书时遇到网络问题阻塞,导致大量线程等待
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wechatpay-apache-httpclient.