alibaba / alibaba/Sentinel

LeapArray#currentWindow resetWindowTo 是否需要double check?

Open
#2,230 9 comments 0 reactions 0 assignees View on GitHub
area/metrics
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

### 描述
![image](https://user-images.githubusercontent.com/16395809/121285070-56ed8b00-c910-11eb-839a-e2a74993b881.png)

个人理解,会不会多个线程同时满足 windowStart > old.windowStart(),并且一个线程先获取了锁,执行完了 resetWindowTo 并释放锁。此时另一个线程又获得了锁,又执行了一次 resetWindowTo

### 版本
1.8.0 并且看了下master分支代码也是这样的

Contributor guide

Open the contributing guide

Research direction

Start at LeapArray#currentWindow and its resetWindowTo call, then review the concurrent path described in the issue and the existing nine-comment discussion. Determine whether two threads can perform the reset for the same window and document or test the expected behavior; done means the double-check question has a confirmed resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.