ARROW-4296: [Plasma] Use one mmap file by default, prevent crash with -f#3490
ARROW-4296: [Plasma] Use one mmap file by default, prevent crash with -f#3490pcmoritz wants to merge 4 commits intoapache:masterfrom
Conversation
2f5e7c6 to
117d03a
Compare
There was a problem hiding this comment.
Remove the command line flag also.
There was a problem hiding this comment.
Why replace 1 with SMALL_OBJECT_SIZE?
There was a problem hiding this comment.
because right now, the memory capacity can (and will!) be off by some amount at the moment (due to the way that dlmalloc is computing the footprint limit).
There was a problem hiding this comment.
We know that this won't cause the page to get unmapped?
There was a problem hiding this comment.
I tried it out and it will, but upon remapping, dlmalloc will use the large granularity size, so this has the desired effect of using one large mmap file.
robertnishihara
left a comment
There was a problem hiding this comment.
If we're truly using one huge page now then we should just send the relevant file descriptor to the clients as soon as they connect and never again.
We should do it in a different PR, but maybe file an issue?
There was a problem hiding this comment.
Remove f from getopt above
There was a problem hiding this comment.
Add note saying that this relies on implementation details of dlmalloc (that after the initial memory mapped file is unmapped, subsequent memory-mapped files will use the same granularity as the first page) and that if we switch to using jemalloc, this may need to change.
Alteratively, you could do
void* pointer_big = plasma::dlmemalign(kBlockSize, system_memory - 128 * sizeof(size_t));
// We do not deallocate this small object so that the memory mapped file never gets unmapped.
void* pointer_small = plasma::dlmalloc(1);
plasma::dlfree(pointer_big);There was a problem hiding this comment.
While you're looking at this code, any idea about this ray-project/ray#3670
Somehow the way the object store computes the total system memory is different from the way we do it in Python (e.g., using psutil).
There was a problem hiding this comment.
not sure what is going on but the only way to guarantee that the two sizes are consistent is to use the same method in both (either psutil or the system call we use here)
There was a problem hiding this comment.
Well we can't really use psutil here because it is in C++, right?
|
This does not guarantee to use one memory mapped file, it just makes it so that there is at least one that is large enough to fit all the objects. |
robertnishihara
left a comment
There was a problem hiding this comment.
LGTM once tests pass. Note that valgrind might complain about pointer_small getting leaked.
1e33c7c to
55c0f27
Compare
|
This is strange. It looks like the plasma client_tests are hanging. They are running in valgrind and get to the point where and then the rest of the valgrind output is never printed. On EC2 on ubuntu 14.04, running the tests in valgrind with works however :| |
|
We recently switched our CI to Ubuntu 16.04 after the conda-forge compiler migration, so it may be specific to 16.04 |
|
Thanks for the pointer. Wow, I can actually reproduce in 16.04! EDIT: It just takes a long time to finish, like about 30 sec on the EC2 machine. |
|
I understand what is going on now. In verbose mode, valgrind prints where it is hanging. The memory consumption of the process goes up during that time (up to ~10GB), so probably on travis it started swapping and hanging). Reducing the plasma store memory in the test seems to fix it. However I'd still like to understand where this PR is introducing the 1 non-freed block (there seem to be no such pointers found). |
|
So apparently valgrind already did the search before this PR, but is now searching more memory because of the initial dlmemalign. So I'd say this is ready to merge if the tests pass now. |
|
the failure is unrelated: |
82f1dce to
c447af5
Compare
This PR is similar to #3434 but also makes sure we only have one well-tested code path to go through.