Wechat-Group / WxJava

微信开发 Java SDK ,支持包括微信支付,开放平台,小程序,企业微信,视频号,公众号等的后端开发
Apache License 2.0
29.86k stars 8.67k forks source link

长时间删除二维码configId, 程序accessToken报错 无法有效兼容? 貌似对于accessToken的并发有点问题? #3354

Open friends110110 opened 2 months ago

friends110110 commented 2 months ago

简要描述

程序批量跑删除二维码的 configId,大概跑了10来个小时突然报错,如下日志: 应该是token方面的原因?

模块版本情况

详细描述

尽量详细描述。请不要使用截图,尽量使用文字描述,代码直接贴上来,日志则请附在后面所示区域。 挨个configId批量删除, 删除了10来个小时,有30来万个无用的二维码configId需要删除

        wxCpService.getExternalContactService().deleteContactWay(configId);

日志

org.springframework.data.redis.RedisSystemException: Redis command interrupted; nested exception is io.lettuce.core.RedisCommandInterruptedException: Command interrupted
    at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:62) ~[spring-data-redis-2.7.10.jar!/:2.7.10]
    at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:41) ~[spring-data-redis-2.7.10.jar!/:2.7.10]
    at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate(PassThroughExceptionTranslationStrategy.java:44) ~[spring-data-redis-2.7.10.jar!/:2.7.10]
    at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:42) ~[spring-data-redis-2.7.10.jar!/:2.7.10]
    at org.springframework.data.redis.connection.lettuce.LettuceConnection.convertLettuceAccessException(LettuceConnection.java:277) ~[spring-data-redis-2.7.10.jar!/:2.7.10]
    at org.springframework.data.redis.connection.lettuce.LettuceConnection.await(LettuceConnection.java:1085) ~[spring-data-redis-2.7.10.jar!/:2.7.10]
    at org.springframework.data.redis.connection.lettuce.LettuceConnection.lambda$doInvoke$4(LettuceConnection.java:938) ~[spring-data-redis-2.7.10.jar!/:2.7.10]
    at org.springframework.data.redis.connection.lettuce.LettuceInvoker$Synchronizer.invoke(LettuceInvoker.java:665) ~[spring-data-redis-2.7.10.jar!/:2.7.10]
    at org.springframework.data.redis.connection.lettuce.LettuceInvoker.just(LettuceInvoker.java:94) ~[spring-data-redis-2.7.10.jar!/:2.7.10]
    at org.springframework.data.redis.connection.lettuce.LettuceKeyCommands.ttl(LettuceKeyCommands.java:322) ~[spring-data-redis-2.7.10.jar!/:2.7.10]
    at org.springframework.data.redis.connection.DefaultedRedisConnection.ttl(DefaultedRedisConnection.java:221) ~[spring-data-redis-2.7.10.jar!/:2.7.10]
    at org.springframework.data.redis.connection.DefaultStringRedisConnection.ttl(DefaultStringRedisConnection.java:1428) ~[spring-data-redis-2.7.10.jar!/:2.7.10]
    at org.springframework.data.redis.core.RedisTemplate.lambda$getExpire$12(RedisTemplate.java:866) ~[spring-data-redis-2.7.10.jar!/:2.7.10]
    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:224) ~[spring-data-redis-2.7.10.jar!/:2.7.10]
    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:191) ~[spring-data-redis-2.7.10.jar!/:2.7.10]
    at org.springframework.data.redis.core.RedisTemplate.getExpire(RedisTemplate.java:866) ~[spring-data-redis-2.7.10.jar!/:2.7.10]
    at me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps.getExpire(RedisTemplateWxRedisOps.java:32) ~[weixin-java-common-4.6.0.jar!/:?]
    at me.chanjar.weixin.cp.config.impl.AbstractWxCpInRedisConfigImpl.isAccessTokenExpired(AbstractWxCpInRedisConfigImpl.java:123) ~[weixin-java-cp-4.6.0.jar!/:?]
    at me.chanjar.weixin.cp.api.impl.WxCpServiceImpl.getAccessToken(WxCpServiceImpl.java:40) ~[weixin-java-cp-4.6.0.jar!/:?]
    at me.chanjar.weixin.cp.api.impl.BaseWxCpServiceImpl.executeInternal(BaseWxCpServiceImpl.java:337) ~[weixin-java-cp-4.6.0.jar!/:?]
    at me.chanjar.weixin.cp.api.impl.BaseWxCpServiceImpl.execute(BaseWxCpServiceImpl.java:289) ~[weixin-java-cp-4.6.0.jar!/:?]
    at me.chanjar.weixin.cp.api.impl.BaseWxCpServiceImpl.post(BaseWxCpServiceImpl.java:258) ~[weixin-java-cp-4.6.0.jar!/:?]
einsitang commented 1 month ago

初步估计是你的删除太频繁了,然后每次删除的时候都经过redis检查accessToken,redis连接池不足导致产生的中断错误