druid icon indicating copy to clipboard operation
druid copied to clipboard

Concurrency bug in DruidSchema.refreshSegmentsForDataSource()

Open leventov opened this issue 7 years ago • 5 comments

segmentMap is created outside of lock, so by the time of SegmentMetadataHolder holder = dataSourceSegments.get(segment); segment could be already removed. It could cause NPE below.

FYI @surekhasaharan @gianm

leventov avatar Jan 09 '19 12:01 leventov

Thanks @leventov , I want to clarify that even if segment is removed, the reference to segment is still there. So where do you think, it can cause a NPE ? Though a null check for dataSourceSegments can be added before SegmentMetadataHolder holder = dataSourceSegments.get(segment);. Does that address your concern ?

surekhasaharan avatar Jan 09 '19 19:01 surekhasaharan

I think the issue is that the segment might have been removed from segmentMetadataInfo, so there would no longer be any holder.

gianm avatar Jan 09 '19 20:01 gianm

thanks @gianm , created a PR

surekhasaharan avatar Jan 10 '19 01:01 surekhasaharan

@surekhasaharan would you please link the PR you raise to this issue? It would work if you mention this issue in your PR.

jihoonson avatar Jan 18 '19 23:01 jihoonson

@leventov I guess it's resolved?

egor-ryashin avatar Apr 12 '19 11:04 egor-ryashin