From 923961c84c0acb166163a1e33bac127ab0559be6 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 3 Apr 2025 09:51:23 -0600 Subject: [PATCH] test/pipe-bug: ignore -ENOMEM on ring creation Since this test case sets up and tears down a ton of rings, this can result in the deferred freeing/unaccounting causing spurious -ENOMEM returns. This is expected if the system is configured to be tight on locked memory (ulimit -l). If this happens, inject a small delay and just have it retry. Link: https://github.com/axboe/liburing/issues/1377 Signed-off-by: Jens Axboe --- test/pipe-bug.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/test/pipe-bug.c b/test/pipe-bug.c index 49e4a9412..c76134486 100644 --- a/test/pipe-bug.c +++ b/test/pipe-bug.c @@ -24,20 +24,26 @@ do { \ static int pipe_bug(void) { - struct io_uring_params p; struct io_uring ring; struct io_uring_sqe *sqe; struct io_uring_cqe *cqe; char buf[1024]; - int fds[2]; + int ret, fds[2]; struct __kernel_timespec to = { .tv_sec = 1 }; - CHECK(pipe(fds) == 0); + ret = io_uring_queue_init(8, &ring, 0); + /* can hit -ENOMEM due to repeated ring creation and teardowns */ + if (ret == -ENOMEM) { + usleep(1000); + return 0; + } else if (ret) { + fprintf(stderr, "ring_init: %d\n", ret); + return 1; + } - memset(&p, 0, sizeof(p)); - CHECK(t_create_ring_params(8, &ring, &p) == 0); + CHECK(pipe(fds) == 0); /* WRITE */ sqe = io_uring_get_sqe(&ring);