Skip to content

Commit

Permalink
Disable obj store pages in raylet coredump (ray-project#30592)
Browse files Browse the repository at this point in the history
Disable object store pages from appearing in Raylet coredumps using madvise(MADV_DONTDUMP). See ray-project#30150 for more context.
Signed-off-by: Cade Daniel <[email protected]>
  • Loading branch information
cadedaniel authored Nov 23, 2022
1 parent c81626d commit 3d6598d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/ray/common/ray_config_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ RAY_CONFIG(int64_t, health_check_period_ms, 3000)
RAY_CONFIG(int64_t, health_check_timeout_ms, 10000)
RAY_CONFIG(int64_t, health_check_failure_threshold, 5)

/// Use madvise to prevent worker coredump from including the mapped plasma pages
/// in the worker processes.
/// Use madvise to prevent worker/raylet coredumps from including
/// the mapped plasma pages.
RAY_CONFIG(bool, worker_core_dump_exclude_plasma_store, true)
RAY_CONFIG(bool, raylet_core_dump_exclude_plasma_store, true)
15 changes: 15 additions & 0 deletions src/ray/object_manager/plasma/dlmalloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,21 @@ void create_and_mmap_buffer(int64_t size, void **pointer, int *fd) {
initial_region_ptr = static_cast<char *>(*pointer);
initial_region_size = size;
}

#ifdef __linux__
if (RayConfig::instance().raylet_core_dump_exclude_plasma_store()) {
int rval = madvise(initial_region_ptr, initial_region_size, MADV_DONTDUMP);
if (rval) {
RAY_LOG(WARNING) << "madvise(MADV_DONTDUMP) call failed: " << rval << ", "
<< strerror(errno);
} else {
RAY_LOG(DEBUG) << "madvise(MADV_DONTDUMP) call succeeded.";
}
} else {
RAY_LOG(DEBUG) << "worker_core_dump_exclude_plasma_store disabled, raylet coredumps "
"will contain the object store mappings.";
}
#endif /* __linux__ */
}

#endif
Expand Down
3 changes: 1 addition & 2 deletions src/ray/object_manager/plasma/shared_memory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ ClientMmapTableEntry::ClientMmapTableEntry(MEMFD_TYPE fd, int64_t map_size)
void ClientMmapTableEntry::MaybeMadviseDontdump() {
if (!RayConfig::instance().worker_core_dump_exclude_plasma_store()) {
RAY_LOG(DEBUG) << "worker_core_dump_exclude_plasma_store disabled, worker coredumps "
"will contain "
<< "the object store mappings.";
"will contain the object store mappings.";
return;
}

Expand Down

0 comments on commit 3d6598d

Please sign in to comment.