-
Notifications
You must be signed in to change notification settings - Fork 965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
saga事务进入无限补偿重试,1个补偿大致每秒重试80次,请问是什么原因? #306
Comments
不应当会发生这种情况,会不会是你的微服务框架自动重试了?你开一下dtm的debug日志,诊断一下,如果还有问题,把日志发给我 |
在 saga BranchHeaders 添加对应的 auth header token 后,新请求可以成功,未添加的请求还在无限重试中。 微服务使用kratos,使用consul做服务发现,框架没有自动重试,在手动点击 dtm admin ui 的 ForceStop 按钮后,dtm停止了无限重试。 dtm使用docker安装,无限重试时dtm重复打印以下日志:
|
给出来的日志太少了,请把重复的内容给出3个重复的 |
|
问题在于你的服务器时钟和数据库的时钟对不上,或者时区对不上,只要时钟和时区对上了,这个问题就解决了 |
感谢您的回复,问题原因已经了解清楚,我试图通过修改docker-compose.yaml环境变量修改时区,但未成功。 mysql 运行在 windows 物理机上,时区为+8:00,dtm server 使用 docker compose 启动,进入docker内查看时区为UTC。配置如下:
config.yaml
如果正式环境使用Kubernetes部署,应该也需要修改时区,请问有解决办法吗?麻烦您了~~ |
这个你可以问一下你们公司运维,或者问一下熟悉docker的同学。 |
再次感谢您一直跟踪回复,谢谢!!已经找公司的运维同学共同寻找解决方法,如果找到了,我会回复在该问题下。 |
我也遇到了这个问题,因为DTM的官方包无法挂载本地时区,在docker-compose.yml中配置 - /etc/timezone:/etc/timezone:ro 和 - /etc/localtime:/etc/localtime:ro不会生效,
|
不管是 docker run , docker-compose , k8s. 都挂载对应时区的 docker run$ docker run -itd --name dtm -p 36789:36789 -p 36790:36790 -v /etc/localtime:/etc/localtime yedf/dtm:latest docker-composedtm:
volumes:
- /etc/localtime:/etc/localtime k8s创建主机路径卷 volumes:
- name: tz-config
hostPath:
path: /etc/localtime 容器挂载卷 volumeMounts:
- name: tz-config
mountPath: /etc/localtime |
@yedf2 @thful @xyctruth 感谢你们的回复,你们的回复给我提供了很好的解决思路。 经过测试,dtm docker 镜像不支持直接设置时区,需要通过挂载时区文件方式设置时区,docker 宿主机为 windows 和 linux 处理方式不同。 在 # syntax=docker/dockerfile:1
# FROM node:14.19-alpine as builder1
# ARG RELEASE_VERSION
# WORKDIR /app/dtm
# COPY . .
# RUN cd admin && yarn && VITE_ADMIN_VERSION=$RELEASE_VERSION yarn build
FROM --platform=$TARGETPLATFORM golang:1.16-alpine as builder2
ARG TARGETARCH
ARG TARGETOS
ARG RELEASE_VERSION
WORKDIR /app/dtm
# RUN go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
EXPOSE 8080
COPY . .
# COPY --from=builder1 /app/dtm/admin/dist /app/dtm/admin
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-s -w -X main.Version=$RELEASE_VERSION"
FROM --platform=$TARGETPLATFORM alpine
COPY --from=builder2 /app/dtm/dtm /app/dtm/
WORKDIR /app/dtm
ENTRYPOINT ["/app/dtm/dtm"]
大致逻辑为:dtm 通过 宿主机 linux 和 windows 兼容方案:
|
最新版本v1.14.3不再要求 dtm的时区与数据库一致: |
感谢及时更新,但 dtm server 更新到
dtm
|
表里面加了字段,fail_reason,加一下就行 |
添加 经过测试,dtm 感谢作者对 dtm 的更新,以及问题的及时回复,dtm 是一个优秀的作品,希望您能不断的完善 dtm 体系,成长为一个健壮的产品,成为微服务体系不可或缺的一环。 |
问题:saga事务进入无限补偿重试,1个补偿大致每秒重试80次,请问是什么原因?
事务:
/goods.service.v1.Goods/StockDeduct
商品库存扣减,/goods.service.v1.Goods/StockDeductRevert
商品库存扣减补偿/order.service.v1.Order/Create
订单创建,/order.service.v1.Order/CreateRevert
订单创建补偿在任务的server端添加了auth jwt 验证,dtm 未添加对应的 auth header token,在这种情况下,
商品库存扣减
和商品库存扣减补偿
都无法成功,dtm进入无限重试商品库存扣减补偿
状态。文档注明会进入
指数退避算法重试
状态,但实际没有,请问是什么原因呢?文档参考The text was updated successfully, but these errors were encountered: