You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PromiseToCompletableFuture shares two fields across threads without volatile #2281
Narrowed on 2026-11-26: this issue now covers only PromiseToCompletableFuture. The DocumentSymbolData.equals/hashCode part moved to #2285, for 0.31.0. The structure view no longer needs the PsiElement match since #1531, and removing it means deprecating the public LSPDocumentSymbolFeature.matchesPsiElement. #2285 has the evidence; the original text of that part is kept below, struck through.
PromiseToCompletableFuture shares two fields between threads without volatile
PromiseToCompletableFuture.java: cancelled (line 43) and nonBlockingReadActionPromise (line 69) are written and read on different threads (the canceller, and the read action's retries) without volatile or a lock.
The worst case found is one more attempt after a cancel, whose result is thrown away. Make them volatile, or confine them to one thread.
Moved to #2285: DocumentSymbolData.equals breaks the equals/hashCode contract
DocumentSymbolData.java:120-137: equals is true for another DocumentSymbolData with an equal symbol, and also for any PsiElement that matchesPsiElement accepts, while hashCode uses only the symbol. So the relation isn't symmetric, and an object equal to data can have another hash code. The matching was added for the Structure View's Always Select Opened Element (#1381, #1531).
changed the title [-]DocumentSymbolData.equals breaks the equals/hashCode contract, and PromiseToCompletableFuture shares two fields across threads without volatile[/-][+]PromiseToCompletableFuture shares two fields across threads without volatile[/+]on Nov 26, 2026
Activity
lagergren commentedon Nov 26, 2026
Split in two:
PromiseToCompletableFuturefields: fixed by fix: PromiseToCompletableFuture cancels a retry's read action that starts as the future is cancelled #2286, which also closes a race where a cancel could miss a retry's read action.DocumentSymbolData.equals/hashCode: moved to DocumentSymbolData.equals: compare symbols only, and deprecate matchesPsiElement, which the structure view no longer needs since #1531 #2285 for 0.31.0. Since fix: Always Select Opened Element should select parent DocumentSymbol #1531, the structure view compares a symbol with a symbol, so thePsiElementbranch is reached only when a symbol is compared with the file'sPsiFile. Removing it changes that edge case and leaves the publicLSPDocumentSymbolFeature.matchesPsiElementuncalled, which needs a deprecation rather than a late 0.30.2 change. DocumentSymbolData.equals: compare symbols only, and deprecate matchesPsiElement, which the structure view no longer needs since #1531 #2285 has the platform code it was checked against, on 2024.2 and 2026.3.[-]DocumentSymbolData.equals breaks the equals/hashCode contract, and PromiseToCompletableFuture shares two fields across threads without volatile[/-][+]PromiseToCompletableFuture shares two fields across threads without volatile[/+]fix: PromiseToCompletableFuture cancels a retry's read action that st…