-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad File descriptor #11
Comments
Hi, this can be occured during io_uring_setup because it cannot allocate a memory in the kernel - resulting it returns -1 ENOMEM but it's not caught up on syscall Errno error check and goes to the mmap fd parameter and when that gets executed it returns EBADF. This is reproducible on C: #include <stdio.h>
#include <stdlib.h>
#include <sys/syscall.h>
#include <unistd.h>
#include <errno.h>
#include <linux/io_uring.h>
int io_uring_setup(unsigned entries, struct io_uring_params *p)
{
return (int) syscall(__NR_io_uring_setup, entries, p);
}
typedef struct slot {
struct io_uring_params p;
int fd;
} slot_t;
int main()
{
#define NMEMB 5000
int slot_cur, fd;
slot_t *slot;
slot_t *slots = calloc(NMEMB, sizeof(slot_t));
for (slot_cur = 0; slot_cur < NMEMB; slot_cur++) {
slot = &slots[slot_cur];
slot->p.features = 0;
fd = io_uring_setup(32768, &slot->p);
if (fd < 0) {
printf("at %d\n", slot_cur);
perror("io_uring_setup");
}
slot->fd = fd;
}
printf("OK\n");
return 0;
} Giving me this result, tho I am not really sure why it can allocate a ring after there's a fail:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
go version ;- 1.21
Linux version - 6.5.0-35-generic #35~22.04.1-Ubuntu SMP
When i am making the new ring buffer many time i am getting error of bad file descriptor. Issue occurs randomly there is no fix pattern for the same. Do i need to change some OS related paramters for the same? Or can you suggest the possible problems for the same.
@ii64 Can you please help in the same
The text was updated successfully, but these errors were encountered: