Doris-Breakwater commented on issue #71461:
URL: https://github.com/apache/doris/issues/71461#issuecomment-7436954429

   The posted `jstack` confirms an FE deadlock in the Iceberg external metadata 
cache. This warrants high-priority FE/lakehouse triage and a fix on 
`branch-4.1` because the deadlock can leave an FE unable to serve queries.
   
   **Verified in 4.1.5.** The refresh thread removes the Iceberg catalog entry 
group and closes it while holding the engine-cache monitor. 
`MetaCacheEntry.invalidateAll()` holds the entry's admission lock and waits in 
Caffeine's `clear()` for a `ConcurrentHashMap` bin. The snapshot miss loader 
holds that same bin while looking up the partition schema. The lookup goes back 
through `ExternalMetaCacheMgr` to `initCatalog()`, where the group is now 
absent and initialization waits for the same engine-cache monitor. Both 
`REFRESH CATALOG` and its replay reach this invalidation path when cache 
invalidation is requested. The supplied dump shows the forwarded SQL path. 
[Catalog initialization and 
invalidation](https://github.com/apache/doris/blob/917b20be83878e98f94e3ebf7efccc80346e3e50/fe/fe-core/src/main/java/org/apache/doris/datasource/metacache/AbstractExternalMetaCache.java#L161-L245),
 [Iceberg refresh 
routing](https://github.com/apache/doris/blob/917b20be83878e98f94e3ebf7efccc80346e3e50
 
/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalMetaCache.java#L587-L603).
   
   **Regression window.** #66717 introduced the shared monitor in `branch-4.1`. 
The `4.1.4-rc01` source lacks those monitor acquisitions. The final `4.1.4` 
source already has them, and its Iceberg refresh clears the existing group in 
place. #66913 changed Iceberg refresh to retire the group, which puts refresh 
on the synchronized close path seen in 4.1.5. [Monitor 
change](https://github.com/apache/doris/pull/66717), [Iceberg group 
retirement](https://github.com/apache/doris/pull/66913).
   
   **Mitigation and remaining evidence.** For FEs running with 
`enable_external_meta_cache_manual_miss_load=false`, restore the default `true` 
where possible. In 4.1.5 this runs the miss loader outside Caffeine's 
synchronous mapping callback and removes the query-side bin-lock edge in the 
posted stack. Weighted and generation-fenced entries already use manual 
loading. A deadlock with the setting enabled remains unverified. If one occurs, 
please share the deadlock section from `jstack -l`, the exact FE build or 
commit, and the effective flag and cache weight settings from that FE. 
[Miss-load selection and 
publication](https://github.com/apache/doris/blob/917b20be83878e98f94e3ebf7efccc80346e3e50/fe/fe-core/src/main/java/org/apache/doris/datasource/metacache/MetaCacheEntry.java#L1330-L1389).
   
   **Next step.** Please open the proposed PR and include the JUnit case as a 
regression test. Detach the retired group and release its budget exactly once 
before replacement initialization. Drain Caffeine and run removal callbacks 
after releasing both the engine-cache monitor and any enclosing catalog 
lifecycle lock. `prepareCatalogByEngine()` also takes that lifecycle lock, and 
catalog removal and property rollback currently call invalidation while holding 
it. Verify that refresh and concurrent loads complete, retired loads cannot 
publish into the replacement group, and deferred cleanup cannot debit the 
replacement budget. Please include the test results for both miss-load settings 
and for weighted retirement. [Catalog lifecycle 
locking](https://github.com/apache/doris/blob/917b20be83878e98f94e3ebf7efccc80346e3e50/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalMetaCacheMgr.java#L407-L513).
   
   Breakwater-GitHub-Analysis-Slot: slot_fd64ed1123d3
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to