-
Notifications
You must be signed in to change notification settings - Fork 641
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
Random test failure: TestNeverDelete.TestIndexing #1090
Comments
I have a theory. We added a hack to the original calculation because if the file size of the last buffer was 0, it would throw an https://github.com/apache/lucenenet/blob/master/src/Lucene.Net/Store/MMapDirectory.cs#L331-L338 But I am not sure the hack makes sense to begin with. The original logic was to allocate a zero byte buffer at the end: https://github.com/apache/lucenenet/blob/master/src/Lucene.Net/Store/MMapDirectory.cs#L307-L308 So, that was intended to be the case, but Microsoft doesn't allow such a thing. However, rather than doing whacky math with the offset, it would probably make more sense to skip the call to the BCL API when the last buffer length is 0, and instead allocate it like: buffers[bufNr] = ByteBuffer.Allocate(0).AsReadOnlyBuffer() |
I can't easily reproduce this one with that seed, which points to a concurrency bug (or at least one that is not reproducible due to concurrency), and that is indicated by the use of ThreadJobs in the test. But I think your theory is sound here, it lines up with the message and stack trace (assuming aggressive inlining likely from PGO), and the solution makes sense to me. I also reviewed ByteBufferIndexInput just to be on the safe side, and since |
@NightOwl888 Actually, once I started digging into this, I'm no longer sure about that. I think the exception is coming from here: if (input.memoryMappedFile is null)
{
input.memoryMappedFile = MemoryMappedFile.CreateFromFile(
fileStream: fc,
mapName: null,
capacity: length,
access: MemoryMappedFileAccess.Read,
#if FEATURE_MEMORYMAPPEDFILESECURITY
memoryMappedFileSecurity: null,
#endif
inheritability: HandleInheritability.Inheritable,
leaveOpen: true); // LUCENENET: We explicitly dispose the FileStream separately.
} This is the place where Where it throws the exception in if (fileSize > capacity)
{
throw new ArgumentOutOfRangeException(nameof(capacity), SR.ArgumentOutOfRange_CapacityGEFileSizeRequired);
} |
The cast here is potentially a problem: https://github.com/apache/lucenenet/blob/master/src/Lucene.Net/Store/MMapDirectory.cs#L329 It can overflow One thing to note is that |
Is there an existing issue for this?
Describe the bug
Got a random test failure on this PR run, ubuntu-latest, net9.0, x64. Re-running the test (with new random values) succeeded.
Expected Behavior
The test passes
Steps To Reproduce
No response
Exceptions (if any)
No response
Lucene.NET Version
No response
.NET Version
9
Operating System
ubuntu-latest
Anything else?
x64
The text was updated successfully, but these errors were encountered: