Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Race condition when using the prefetchableClientReadHandler #2369

Open
3 tasks done
zuston opened this issue Feb 13, 2025 · 3 comments
Open
3 tasks done

[Bug] Race condition when using the prefetchableClientReadHandler #2369

zuston opened this issue Feb 13, 2025 · 3 comments

Comments

@zuston
Copy link
Member

zuston commented Feb 13, 2025

Code of Conduct

Search before asking

  • I have searched in the issues and found no similar issues.

Describe the bug

Image

The bug happens on the code.

ShuffleDataResult result = null;
while (segmentIndex < shuffleDataSegments.size()) {
ShuffleDataSegment segment = shuffleDataSegments.get(segmentIndex);
Roaring64NavigableMap blocksOfSegment = Roaring64NavigableMap.bitmapOf();
segment.getBufferSegments().forEach(block -> blocksOfSegment.addLong(block.getBlockId()));
// skip unexpected blockIds
blocksOfSegment.and(expectBlockIds);
if (!blocksOfSegment.isEmpty()) {
// skip processed blockIds
blocksOfSegment.or(processBlockIds);
blocksOfSegment.xor(processBlockIds);
if (!blocksOfSegment.isEmpty()) {
result = readShuffleData(segment);
segmentIndex++;
break;
}
}
segmentIndex++;
}
return result;
}

The processedBlockId will be modified in the ShuffleReadClientImpl at the same time.

If so, we have to use synchronize to lock all related processBlockId operations.

Affects Version(s)

master

Uniffle Server Log Output

Uniffle Engine Log Output

Uniffle Server Configurations

Uniffle Engine Configurations

Additional context

cc @jerqi

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@zuston
Copy link
Member Author

zuston commented Feb 13, 2025

cc @jerqi Do you have any ideas on this?

@jerqi
Copy link
Contributor

jerqi commented Feb 25, 2025

cc @jerqi Do you have any ideas on this?

Maybe we can use concurrentHashMap instead of bitmap.

@summaryzb
Copy link
Contributor

This is fixed by #2368

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

No branches or pull requests

3 participants