From b2a595ceea00f3d3394d53ca99d60d304a13218e Mon Sep 17 00:00:00 2001 From: Shawn Zhong Date: Mon, 20 Nov 2023 17:28:02 -0600 Subject: [PATCH] Handle io_setup error properly (#465) --- src/linux_aligned_file_reader.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/linux_aligned_file_reader.cpp b/src/linux_aligned_file_reader.cpp index 47c7cb1fb..31bf5f827 100644 --- a/src/linux_aligned_file_reader.cpp +++ b/src/linux_aligned_file_reader.cpp @@ -147,10 +147,14 @@ void LinuxAlignedFileReader::register_thread() if (ret != 0) { lk.unlock(); - assert(errno != EAGAIN); - assert(errno != ENOMEM); - std::cerr << "io_setup() failed; returned " << ret << ", errno=" << errno << ":" << ::strerror(errno) - << std::endl; + if (ret == -EAGAIN) + { + std::cerr << "io_setup() failed with EAGAIN: Consider increasing /proc/sys/fs/aio-max-nr" << std::endl; + } + else + { + std::cerr << "io_setup() failed; returned " << ret << ": " << ::strerror(-ret) << std::endl; + } } else {