-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Correctly handle failing mmap on FileReader. #867
Conversation
@BPerlakiH can you test this on your side ? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #867 +/- ##
==========================================
+ Coverage 58.00% 58.07% +0.07%
==========================================
Files 101 101
Lines 4622 4623 +1
Branches 1923 1922 -1
==========================================
+ Hits 2681 2685 +4
+ Misses 667 665 -2
+ Partials 1274 1273 -1 ☔ View full report in Codecov by Sentry. |
@mgautierfr I have tested with this branch by replacing it in
and it is still crashing at the same point with:
|
This branch doesn't have traces. So if you have this output you probably not testing the right thing. |
@mgautierfr Are we not impacted by kiwix/kiwix-build#32? Are we sure that kiwix-build has the HEAD of the proper branch? |
@BPerlakiH you have to checkout yourself the right branch (but as you already done it for
No. A checkout to the right branch and a build (of libzim AND libkiwix (as libkiwix is statically linked to libzim)) and you should be ok (
If there is no modification of the code (clean working directory) and kiwix-build is configured to get the branch you are on (see kiwix/kiwix-build@2359d09 for example), kiwix-build update the source code automatically Of course, all this is true if you don't ask to not do it ( |
@veloman-yunkan please review without waiting confirmation for @BPerlakiH, I'm pretty confident it is a real bug and we should merge it, whatever it fixes the linked issue or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While reviewing this PR, I seem to have found another bug. I believe its fix should be included in this PR (and the title and description of the PR properly updated).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And what do you think of introducing a base class for FileReader
and MultiPartFileReader
that will provide a partial implementation of the get_buffer()
method in terms of a new virtual function get_mmapped_buffer()
? Such a class can also be a common place for the data members _offset
and _size
and their accessor methods.
@mgautierfr I am not sure about this part. I did as described earlier, changing the Maybe we need a more step by step instructions how to build this the right way, or if you could send me a complete xcframework built with your changes, that would be even easier for me to test. |
When @mgautierfr mentions a clean state, I believe you need to remove |
I have launch a new build for provide you a xcframework.
You should not. The
If you change the You can directly goes into Or you can remove |
Thank you @mgautierfr , |
I think well about this. I will do it. |
13b94f2
to
14b2306
Compare
Done. Ready for another review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have only one slight concern. If it is unjustified paranoia then this is an approval.
If we try to mmap a region to high (>4GB), `makeMmappedBuffer` will throw a `MMapException`. In this case, we want to do a read in the file instead of mmap. This case is handled in `MultiPartFileReader` but was missing in `FileReader`. Fix #866
This commit move only the _size and _offset (and accessors) in BaseFileReader.
da116cd
to
31ce7f0
Compare
31ce7f0
to
65a21af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Rebase&fixup is due.
BaseFileReader is now responsible for trying to get a mmap and then fallback to reading in file.
65a21af
to
9ce2e3b
Compare
Done |
9ce2e3b
to
916afdf
Compare
If we try to mmap a region to high (>4GB),
makeMmappedBuffer
will throw aMMapException
. In this case, we want to do a read in the file instead of mmap.This case is handled in
MultiPartFileReader
but was missing inFileReader
.Fix #866