Aias00 opened a new issue, #6783:
URL: https://github.com/apache/shenyu/issues/6783

   - Severity: Medium
   - Location:
   
`shenyu-sync-data-center/shenyu-sync-data-consul/src/main/java/org/apache/shenyu/sync/data/consul/ConsulSyncDataService.java:63,65`
 (HashMap fields), `:98` (7-thread `ScheduledThreadPoolExecutor`), `:103-111` 
(7 scheduled `watcherData0` tasks)
   - 
   Description:
   `consulIndexes` (`Map<String, Long>`) and `cacheConsulDataKeyMap` 
(`Map<String, List<ConsulData>>`) are plain `HashMap`. The executor has 7 
threads and schedules 7 independent `watchConfigKeyValues` tasks (one per 
watcher path). Each task performs `consulIndexes.get`, 
`consulIndexes.containsValue` (full-map scan), `consulIndexes.put`, 
`cacheConsulDataKeyMap.get`, `cacheConsulDataKeyMap.put` on these shared maps. 
`HashMap` is not safe for concurrent access — structural modifications (put 
during resize) can corrupt internal structure or lose data; `containsValue` 
racing with `put` produces inconsistent reads.
   - 
   Impact:
   Under normal multi-path consul operation, concurrent access corrupts data, 
loses index updates (watcher misses config changes or re-processes them), 
inconsistent gateway cache state.
   - 
   Suggested fix:
   Change both to `ConcurrentHashMap`.
   - 
   Confidence: High
   - Related existing: none — #5545 (consul client metadata register fails) is 
a different component/root cause.
   
   ---
   _Identified during the 2026-08-02 deep re-scan; full list in 
[`docs/scan2-2026-08-02/06-medium-tiers.md`](docs/scan2-2026-08-02/06-medium-tiers.md)._


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to