mirror of
https://github.com/facebook/rocksdb.git
synced 2026-07-07 14:47:40 +08:00
Log errno and thread ID on CreateIOUring failure (#14520)
Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/14520 CreateIOUring() silently returns nullptr on failure, discarding the errno from io_uring_queue_init. This makes it impossible to diagnose why io_uring initialization fails on specific threads (e.g. ENOMEM from memlock limits, EINVAL from unsupported flags, EMFILE from fd exhaustion). Add a fprintf(stderr, ...) that logs strerror, errno, and pthread thread ID when io_uring_queue_init fails, so failures are diagnosable from logs without needing to reproduce. Reviewed By: xingbowang Differential Revision: D98526792 fbshipit-source-id: 1eb5042c8b62663c4d24c09f29ef7c55b90032f0
This commit is contained in:
committed by
meta-codesync[bot]
parent
5db0603613
commit
2af38206ad
Vendored
-1
@@ -1096,7 +1096,6 @@ IOStatus PosixRandomAccessFile::ReadAsync(
|
||||
|
||||
// Init failed, platform doesn't support io_uring.
|
||||
if (iu == nullptr) {
|
||||
fprintf(stderr, "failed to init io_uring\n");
|
||||
return IOStatus::NotSupported("ReadAsync: failed to init io_uring");
|
||||
}
|
||||
|
||||
|
||||
Vendored
+8
@@ -10,8 +10,13 @@
|
||||
#include <errno.h>
|
||||
#if defined(ROCKSDB_IOURING_PRESENT)
|
||||
#include <liburing.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "util/string_util.h"
|
||||
|
||||
// Compatibility defines for io_uring flags that may not be present in older
|
||||
// kernel headers. These values are fixed and won't change, so it's safe to
|
||||
// define them even if the running kernel doesn't support them.
|
||||
@@ -341,6 +346,9 @@ inline struct io_uring* CreateIOUring() {
|
||||
flags |= IORING_SETUP_DEFER_TASKRUN;
|
||||
int ret = io_uring_queue_init(kIoUringDepth, new_io_uring, flags);
|
||||
if (ret) {
|
||||
fprintf(stderr, "CreateIOUring failed: %s (errno=%d), thread=%lu\n",
|
||||
errnoStr(-ret).c_str(), -ret,
|
||||
static_cast<unsigned long>(pthread_self()));
|
||||
delete new_io_uring;
|
||||
new_io_uring = nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user