Skip to content

Commit 55f0fad

Browse files
dbortfacebook-github-bot
authored andcommitted
Clarify log when ignoring mlock error
Summary: It's been confusing to users when they see an Error-level log complaining about an `mlock()` failure even though it's being ignored. We do print a follow-up Info line after it, but some users may disable Info messages. Instead, print the message at Info level when ignoring it, and make it clear that it is being ignored. While I'm here, print the file offset of the region that we're trying to lock, to make it easier to figure out which segment is failing to lock. Differential Revision: D53876334
1 parent 7b1ac5d commit 55f0fad

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

extension/data_loader/mmap_data_loader.cpp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,17 +199,27 @@ Result<FreeableBuffer> MmapDataLoader::Load(size_t offset, size_t size) {
199199
mlock_config_ == MlockConfig::UseMlockIgnoreErrors) {
200200
int err = ::mlock(pages, size);
201201
if (err < 0) {
202-
ET_LOG(
203-
Error,
204-
"File %s: mlock(%p, %zu) failed: %s (%d)",
205-
file_name_,
206-
pages,
207-
size,
208-
::strerror(errno),
209-
errno);
210202
if (mlock_config_ == MlockConfig::UseMlockIgnoreErrors) {
211-
ET_LOG(Info, "Ignoring mlock() error");
203+
ET_LOG(
204+
Info,
205+
"Ignoring mlock error for file %s (off=0x%zd): "
206+
"mlock(%p, %zu) failed: %s (%d)",
207+
file_name_,
208+
offset,
209+
pages,
210+
size,
211+
::strerror(errno),
212+
errno);
212213
} else {
214+
ET_LOG(
215+
Error,
216+
"File %s (off=0x%zd): mlock(%p, %zu) failed: %s (%d)",
217+
file_name_,
218+
offset,
219+
pages,
220+
size,
221+
::strerror(errno),
222+
errno);
213223
::munmap(pages, size);
214224
return Error::NotSupported;
215225
}

0 commit comments

Comments
 (0)