Skip to content

fix: deadlock in HeapMemorySegmentMetadataCache#19240

Merged
kgyrtkirk merged 4 commits intoapache:masterfrom
kgyrtkirk:hms-stall2
Apr 1, 2026
Merged

fix: deadlock in HeapMemorySegmentMetadataCache#19240
kgyrtkirk merged 4 commits intoapache:masterfrom
kgyrtkirk:hms-stall2

Conversation

@kgyrtkirk
Copy link
Copy Markdown
Member

deadlock was happening as:

  • markCacheSynced holds datasourceToSegmentCache lock; waits HeapMemoryDatasourceSegmentCache for an empty one
  • writeCacheForDataSource acquires HeapMemoryDatasourceSegmentCache lock and tries to HeapMemorySegmentMetadataCache#getCacheWithReference which needs the datasourceToSegmentCache lock

tests like KafkaClusterMetricsTest may start hanging due to this

see stacktrace and repro here

@gianm gianm changed the title bug: fix deadlock in HeapMemorySegmentMetadataCache fix: deadlock in HeapMemorySegmentMetadataCache Mar 31, 2026
@kgyrtkirk kgyrtkirk merged commit 0ac00fa into apache:master Apr 1, 2026
88 of 91 checks passed
@kgyrtkirk kgyrtkirk deleted the hms-stall2 branch April 1, 2026 05:27
@kgyrtkirk
Copy link
Copy Markdown
Member Author

thank you @gianm for taking a look!

@github-actions github-actions bot added this to the 37.0.0 milestone Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants