[Bug]: Overview top-table cache is not published atomically
I maintainer di solito rispondono entro 2 giorni
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
What happened?
The AMS overview page periodically refreshes its cached list of top tables. This cache is shared between:
- A background thread that refreshes the cache.
- HTTP request threads that read the cache for the
/api/ams/v1/overview/topendpoint.
The cache is currently a regular ArrayList, which is not thread-safe. During a refresh, AMS first removes every entry and then adds the updated entries:
this.allTopTableItem.clear();
this.allTopTableItem.addAll(topTableItemMap.values());
These are two separate operations. An HTTP request can read the cache after clear() has completed but before addAll() has completed. In that case, the API may temporarily return an empty top-table list even though tables exist.
A request may also copy the list while it is being modified. Because the read and write operations are not synchronized, this can produce an inconsistent result or a runtime exception.
Expected behavior:
Every request should receive a complete cache snapshot—either the snapshot from before the refresh or the new snapshot after the refresh.
Actual behavior:
Requests can observe the temporary or partially updated state of the cache while a background refresh is running.
This issue is intermittent and depends on the timing of the background refresh and incoming HTTP requests.
Affects Versions
master
What table formats are you seeing the problem on?
Mixed-Hive, Mixed-Iceberg, Paimon, Iceberg
What engines are you seeing the problem on?
AMS
How to reproduce
This is an intermittent concurrency issue.
-
Start AMS with several registered tables.
-
Configure a short overview cache refresh interval, for example:
overview-cache: refresh-interval: 1s -
Continuously send concurrent requests to:
GET /api/ams/v1/overview/top?order=asc&orderBy=tableSize&limit=10 -
Allow the scheduled OverviewManager refresh to run while the requests are being processed.
-
Compare the returned top-table lists across requests.
Because refreshTableCache() calls clear() and addAll() separately on a shared ArrayList, a request can run after clear() but before addAll(), or while the ArrayList storage is being modified. The response can consequently contain an empty or inconsistent top-table list even though registered tables exist.
The race can also be demonstrated with a concurrency test that repeatedly invokes OverviewManager.refresh() in one thread while other threads call getAllTopTableItem().
Relevant log output
No deterministic log output is available because this is a timing-dependent race. Depending on timing, the request may return an inconsistent result without logging an exception.
Anything else
No response
Are you willing to submit a PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
- Lingua principale
- Java
- Stelle
- 1.2k
- Fork
- 398
- Merge medio
- 3g 11h
- PR unite (30g)
- 23
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/amoro
-
[CI] Core CI doesn't run for changes to amoro-format-lance (and amoro-web)Forse già presa @MarkAlex1234 l’ha presa 18 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 2 giorni
-
[Improvement]: Fix CVEs by upgrading Commons Compress and PostgreSQL JDBCForse già presa @smallyao l’ha presa 1 giorno fa. Apertatype:improvement
Difficoltà 2/5 1-3 ore Idoneità per principianti 57/100
I maintainer di solito rispondono entro 2 giorni
-
type:bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
apache/amoro#4461 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
[Subtask]: Migrate OpenAPI SDK tests to JUnit 5Forse già presa @hutiefang76 l’ha presa 2 giorni fa. Aperta
apache/amoro#4459 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
[Improvement]: Replace the AMS embedded Derby database with H2Forse già presa @xxubai l’ha presa 3 giorni fa. Apertatype:improvement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di apache/amoro
Issue simili
-
[Bug]: REST API URL starting with "http" but no scheme (e.g. httpbin.org/get) is not given an http:// prefixForse già presa @ItsDeadlyProgrammer l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
appsmithorg/appsmith#42471 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
code-maintenance
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno
-
bug priority: medium Review effort [1-5]: 3 status: needs-triage type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
carlos-emr/carlos#5258 ·
I maintainer di solito rispondono entro 1 giorno
-
bug: author create/update with an unknown avatarId returns 404 instead of 400 UNKNOWN_REFERENCEForse già presa @Vinu2111 l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
atomityhq/blog-cms#59 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
PlatformSpecific.hasGreenThreads incorrectly returns false for JDK updates and non-GA versionsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno