Skip to content
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

fix race condition when TTL=0 #458

Merged
merged 1 commit into from
Aug 5, 2021
Merged

fix race condition when TTL=0 #458

merged 1 commit into from
Aug 5, 2021

Conversation

tonicmuroq
Copy link
Contributor

有这么一种 race: 在 core 创建容器的时候, 还没有把容器保存下来呢, agent 那边进程起来了, detect 到了, 开始报 status 了.

  • 如果 TTL 不是 0, 那么 agent 会一直报, 前几次可能没有容器数据所以也没有成功写入 status, 但是之后总可以成功.
  • 如果 TTL 是 0, 这是 agent 开启了 selfmon 模式, 那么第一次之后因为数据相同都不会尝试请求了, 而第一次尝试写入又是失败的, 这样这个容器除非 agent 重启, 否则永远没有 status 了.

考虑到以上, 觉得 TTL 为 0 的时候不需要去检测有没有 entity, 没有就没有吧... 多大点事... 毕竟这个事情不能在 agent 这改, agent 是尝试多少次好呢, 多少次都不行... 顺便, 有没有可能 cachecloud 拿个 IP 要半天就是因为这个, 那个集群里 120s 才能报一次呢, 如果第一次写失败, 下一次需要等两分钟...

@CMGS
Copy link
Contributor

CMGS commented Aug 5, 2021

覆盖率下降了

@tonicmuroq
Copy link
Contributor Author

我不管, 我本地跑还有挂了的测试呢

@tonicmuroq
Copy link
Contributor Author

同样的 case, 代码行数拆多了当然下降了, 不要 care

@CMGS
Copy link
Contributor

CMGS commented Aug 5, 2021

加 case

@CMGS CMGS merged commit a02f8d0 into master Aug 5, 2021
@tonicmuroq tonicmuroq deleted the fix-this-race branch August 6, 2021 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants