wechatpay-apiv3 / wechatpay-apache-httpclient

微信支付 APIv3 Apache HttpClient装饰器(decorator)
https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/index.shtml
Apache License 2.0
674 stars 251 forks source link

[BUG] 下载平台证书时遇到网络问题阻塞,导致大量线程等待 #210

Open dyjxg4xygary opened 6 months ago

dyjxg4xygary commented 6 months ago

报错: EXCEPTION:com.alibaba.dubbo.rpc.RpcException: cause: Server side(x.x.x.x:20880) threadpool is exhausted ,detail msg:Thread pool is EXHAUSTED! Thread Name: DubboServerHandler-x.x.x.x:20880, Pool Size: 300 (active: 300, core: 300, max: 300, largest: 300), Task: 365257 (completed: 364957), Executor status:(isShutdown:false, isTerminated:false, isTerminating:false), in dubbo://x.x.x.x:20880! 重现步骤: 1,下载平台证书时,网络出现问题,导致线程卡在网络请求 2,发起其他业务请求,超过一定数量 3,线程池满报错 原因: CertificatesManager 有synchronized锁, downloadAndUpdateCert方法的http请求卡住之后,putMerchant方法会阻塞 下载平台证书的时候需要设置超时时间,防止线程死掉.