René's URL Explorer Experiment


Title: 调用微信接口异常重试逻辑问题 · Issue #2098 · binarywang/WxJava · GitHub

Open Graph Title: 调用微信接口异常重试逻辑问题 · Issue #2098 · binarywang/WxJava

X Title: 调用微信接口异常重试逻辑问题 · Issue #2098 · binarywang/WxJava

Description: 简要描述 调用微信接口响应超时异常,会导致重复调用接口,从而导致重复发送模板消息、客服消息等 模块版本情况 WxJava 模块名: weixin-java-mp WxJava 版本号: 4.0.8.B 详细描述 重试逻辑有问题,问题代码 errorCode == -1 时会重试 https://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfcd9a5eee93e209207cd245f4e81a/weixin-java-...

Open Graph Description: 简要描述 调用微信接口响应超时异常,会导致重复调用接口,从而导致重复发送模板消息、客服消息等 模块版本情况 WxJava 模块名: weixin-java-mp WxJava 版本号: 4.0.8.B 详细描述 重试逻辑有问题,问题代码 errorCode == -1 时会重试 https://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfc...

X Description: 简要描述 调用微信接口响应超时异常,会导致重复调用接口,从而导致重复发送模板消息、客服消息等 模块版本情况 WxJava 模块名: weixin-java-mp WxJava 版本号: 4.0.8.B 详细描述 重试逻辑有问题,问题代码 errorCode == -1 时会重试 https://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfc...

Opengraph URL: https://github.com/binarywang/WxJava/issues/2098

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"调用微信接口异常重试逻辑问题","articleBody":"### 简要描述\r\n调用微信接口响应超时异常,会导致重复调用接口,从而导致重复发送模板消息、客服消息等\r\n\r\n### 模块版本情况\r\n* WxJava 模块名: weixin-java-mp\r\n* WxJava 版本号: 4.0.8.B\r\n\r\n### 详细描述\r\n重试逻辑有问题,问题代码\r\n\u003e errorCode == -1 时会重试\r\n\r\nhttps://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfcd9a5eee93e209207cd245f4e81a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java#L336-L353\r\n\u003e 请求超时(连接超时、响应超时),WxError.getErrorCode() 默认是 -1\r\n\r\nhttps://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfcd9a5eee93e209207cd245f4e81a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java#L401-L404\r\n\r\nhttps://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfcd9a5eee93e209207cd245f4e81a/weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxErrorException.java#L25-L28\r\n\r\n\u003e 以下异常定义\r\n\r\n```java\r\n// errorCode == -1 \r\nthrow new WxErrorException(\"请先设置WebhookKey\");\r\n```\r\n\r\n基于以上代码,可以发现\r\n- `IOException`异常会导致重试(猜测这个并不需要重试,会导致响应超时异常也重复调用接口,影响:调用发送模板、发送群推等接口会导致用户收到多条)\r\n- `throw new WxErrorException(\"异常信息\")`定义异常会导致重试\r\n- 微信官方接口返回`{\"errcode\":-1,\"errmsg\":\"system error rid: 60891646-03eed615-7f6889ef\"}`会重试(猜测实现重试是这个意图)\r\n### 日志\r\n\u003e 此处复现的是连接超时导致重试(响应超时也会存在重试问题)\r\n\r\n```text\r\n2021-04-29 11:59:20.825 ERROR 6517 --- [sync-scheduler1] m.c.w.mp.api.impl.BaseWxMpServiceImpl    : \r\n【请求地址】: https://api.weixin.qq.com/cgi-bin/material/get_materialcount?access_token=token脱敏\r\n【请求参数】:null\r\n【异常信息】:java.net.SocketException: Connection reset\r\n2021-04-29 11:59:20.827  WARN 6517 --- [sync-scheduler1] m.c.w.mp.api.impl.BaseWxMpServiceImpl    : 微信系统繁忙,1000 ms 后重试(第1次)\r\n2021-04-29 11:59:26.836 ERROR 6517 --- [sync-scheduler1] m.c.w.mp.api.impl.BaseWxMpServiceImpl    : \r\n【请求地址】: https://api.weixin.qq.com/cgi-bin/material/get_materialcount?access_token=token脱敏\r\n【请求参数】:null\r\n【异常信息】:java.net.SocketException: Connection reset\r\n2021-04-29 11:59:26.836  WARN 6517 --- [sync-scheduler1] m.c.w.mp.api.impl.BaseWxMpServiceImpl    : 微信系统繁忙,2000 ms 后重试(第2次)\r\n2021-04-29 11:59:33.840 ERROR 6517 --- [sync-scheduler1] m.c.w.mp.api.impl.BaseWxMpServiceImpl    : \r\n【请求地址】: https://api.weixin.qq.com/cgi-bin/material/get_materialcount?access_token=token脱敏\r\n【请求参数】:null\r\n【异常信息】:java.net.SocketException: Connection reset\r\n2021-04-29 11:59:33.840  WARN 6517 --- [sync-scheduler1] m.c.w.mp.api.impl.BaseWxMpServiceImpl    : 微信系统繁忙,4000 ms 后重试(第3次)\r\n2021-04-29 11:59:42.848 ERROR 6517 --- [sync-scheduler1] m.c.w.mp.api.impl.BaseWxMpServiceImpl    : \r\n【请求地址】: https://api.weixin.qq.com/cgi-bin/material/get_materialcount?access_token=token脱敏\r\n【请求参数】:null\r\n【异常信息】:java.net.SocketException: Connection reset\r\n2021-04-29 11:59:42.848  WARN 6517 --- [sync-scheduler1] m.c.w.mp.api.impl.BaseWxMpServiceImpl    : 微信系统繁忙,8000 ms 后重试(第4次)\r\n2021-04-29 11:59:55.866 ERROR 6517 --- [sync-scheduler1] m.c.w.mp.api.impl.BaseWxMpServiceImpl    : \r\n【请求地址】: https://api.weixin.qq.com/cgi-bin/material/get_materialcount?access_token=token脱敏\r\n【请求参数】:null\r\n【异常信息】:java.net.SocketException: Connection reset\r\n2021-04-29 12:00:26.431  WARN 6517 --- [sync-scheduler1] m.c.w.mp.api.impl.BaseWxMpServiceImpl    : 微信系统繁忙,16000 ms 后重试(第5次)\r\n2021-04-29 12:01:10.443 ERROR 6517 --- [sync-scheduler1] m.c.w.mp.api.impl.BaseWxMpServiceImpl    : \r\n【请求地址】: https://api.weixin.qq.com/cgi-bin/material/get_materialcount?access_token=token脱敏\r\n【请求参数】:null\r\n【异常信息】:java.net.SocketException: Connection reset\r\n2021-04-29 12:01:10.445  WARN 6517 --- [sync-scheduler1] m.c.w.mp.api.impl.BaseWxMpServiceImpl    : 重试达到最大次数【5】\r\n```\r\n\r\n### 修复建议\r\nhttps://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfcd9a5eee93e209207cd245f4e81a/weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxErrorException.java#L11-L13\r\nhttps://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfcd9a5eee93e209207cd245f4e81a/weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxErrorException.java#L25-L28\r\n初始化默认值-1,改成其他(比如-99、-10000等),保证不和微信接口官方返回错误码重复即可","author":{"url":"https://github.com/foreveryang321","@type":"Person","name":"foreveryang321"},"datePublished":"2021-04-29T05:24:58.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/2098/WxJava/issues/2098"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:0acd5cab-75a2-8d25-6413-fe88f0f0a1fa
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDC76:3EE28E:2E02937:3F15953:6964E4B6
html-safe-noncefea4c74f8e3c4366d249c19b6cc52b72803ee4747216626cfe2f94295d9fd4c7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQzc2OjNFRTI4RToyRTAyOTM3OjNGMTU5NTM6Njk2NEU0QjYiLCJ2aXNpdG9yX2lkIjoiODkwMjYyMTA1MDU3NDI2NzU3NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaca750879027811d60b0212a45e0febba7bf236910480386b261c80176ae0d4dee
hovercard-subject-tagissue:870623168
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/binarywang/WxJava/2098/issue_layout
twitter:imagehttps://opengraph.githubassets.com/889d809ee0ead037d047c4c2a96734ef48ff3732c276dcd762d84566779d950f/binarywang/WxJava/issues/2098
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/889d809ee0ead037d047c4c2a96734ef48ff3732c276dcd762d84566779d950f/binarywang/WxJava/issues/2098
og:image:alt简要描述 调用微信接口响应超时异常,会导致重复调用接口,从而导致重复发送模板消息、客服消息等 模块版本情况 WxJava 模块名: weixin-java-mp WxJava 版本号: 4.0.8.B 详细描述 重试逻辑有问题,问题代码 errorCode == -1 时会重试 https://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfc...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameforeveryang321
hostnamegithub.com
expected-hostnamegithub.com
None5838582163a1256e5ebd5086b7e1dc5cea93d82086c9c8b1395fb50f6ddab28d
turbo-cache-controlno-preview
go-importgithub.com/binarywang/WxJava git https://github.com/binarywang/WxJava.git
octolytics-dimension-user_id1343140
octolytics-dimension-user_loginbinarywang
octolytics-dimension-repository_id49122742
octolytics-dimension-repository_nwobinarywang/WxJava
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49122742
octolytics-dimension-repository_network_root_nwobinarywang/WxJava
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8edad3509fd3b4374694551987974bbbcfd316c0
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/binarywang/WxJava/issues/2098#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fbinarywang%2FWxJava%2Fissues%2F2098
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fbinarywang%2FWxJava%2Fissues%2F2098
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=binarywang%2FWxJava
Reloadhttps://github.com/binarywang/WxJava/issues/2098
Reloadhttps://github.com/binarywang/WxJava/issues/2098
Reloadhttps://github.com/binarywang/WxJava/issues/2098
binarywang https://github.com/binarywang
WxJavahttps://github.com/binarywang/WxJava
Please reload this pagehttps://github.com/binarywang/WxJava/issues/2098
Notifications https://github.com/login?return_to=%2Fbinarywang%2FWxJava
Fork 9k https://github.com/login?return_to=%2Fbinarywang%2FWxJava
Star 32.4k https://github.com/login?return_to=%2Fbinarywang%2FWxJava
Code https://github.com/binarywang/WxJava
Issues 17 https://github.com/binarywang/WxJava/issues
Pull requests 4 https://github.com/binarywang/WxJava/pulls
Discussions https://github.com/binarywang/WxJava/discussions
Actions https://github.com/binarywang/WxJava/actions
Wiki https://github.com/binarywang/WxJava/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/binarywang/WxJava/security
Please reload this pagehttps://github.com/binarywang/WxJava/issues/2098
Insights https://github.com/binarywang/WxJava/pulse
Code https://github.com/binarywang/WxJava
Issues https://github.com/binarywang/WxJava/issues
Pull requests https://github.com/binarywang/WxJava/pulls
Discussions https://github.com/binarywang/WxJava/discussions
Actions https://github.com/binarywang/WxJava/actions
Wiki https://github.com/binarywang/WxJava/wiki
Security https://github.com/binarywang/WxJava/security
Insights https://github.com/binarywang/WxJava/pulse
New issuehttps://github.com/login?return_to=https://github.com/binarywang/WxJava/issues/2098
New issuehttps://github.com/login?return_to=https://github.com/binarywang/WxJava/issues/2098
#2122https://github.com/binarywang/WxJava/pull/2122
调用微信接口异常重试逻辑问题https://github.com/binarywang/WxJava/issues/2098#top
#2122https://github.com/binarywang/WxJava/pull/2122
4.1.0https://github.com/binarywang/WxJava/milestone/23
https://github.com/foreveryang321
https://github.com/foreveryang321
foreveryang321https://github.com/foreveryang321
on Apr 29, 2021https://github.com/binarywang/WxJava/issues/2098#issue-870623168
https://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfcd9a5eee93e209207cd245f4e81a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java#L336-L353https://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfcd9a5eee93e209207cd245f4e81a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java#L336-L353
https://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfcd9a5eee93e209207cd245f4e81a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java#L401-L404https://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfcd9a5eee93e209207cd245f4e81a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java#L401-L404
https://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfcd9a5eee93e209207cd245f4e81a/weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxErrorException.java#L25-L28https://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfcd9a5eee93e209207cd245f4e81a/weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxErrorException.java#L25-L28
https://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfcd9a5eee93e209207cd245f4e81a/weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxErrorException.java#L11-L13https://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfcd9a5eee93e209207cd245f4e81a/weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxErrorException.java#L11-L13
https://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfcd9a5eee93e209207cd245f4e81a/weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxErrorException.java#L25-L28https://github.com/Wechat-Group/WxJava/blob/15bd95c3cbbfcd9a5eee93e209207cd245f4e81a/weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxErrorException.java#L25-L28
4.1.0https://github.com/binarywang/WxJava/milestone/23
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.