public inbox for [email protected]
 help / color / mirror / Atom feed
* io_uring process termination/killing is not working
@ 2020-08-12 17:58 Josef
  2020-08-12 18:05 ` Jens Axboe
  0 siblings, 1 reply; 29+ messages in thread
From: Josef @ 2020-08-12 17:58 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, norman

[-- Attachment #1: Type: text/plain, Size: 402 bytes --]

Hi,

I have a weird issue on kernel 5.8.0/5.8.1, SIGINT even SIGKILL
doesn't work to kill this process(always state D or D+), literally I
have to terminate my VM because even the kernel can't kill the process
and no issue on 5.7.12-201, however if IOSQE_IO_LINK is not set, it
works

I've attached a file to reproduce it
or here
https://gist.github.com/1Jo1/15cb3c63439d0c08e3589cfa98418b2c

---
Josef

[-- Attachment #2: io_uring_process.c --]
[-- Type: application/octet-stream, Size: 1878 bytes --]

#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <sys/socket.h>
#include <unistd.h>
#include <poll.h>
#include "liburing.h"

#define BACKLOG 512

#define PORT 9100

struct io_uring ring;

void add_poll(struct io_uring *ring, int fd) {
    struct io_uring_sqe *sqe = io_uring_get_sqe(ring);
    io_uring_prep_poll_add(sqe, fd, POLLIN);
    sqe->flags |= IOSQE_IO_LINK;
}

void add_accept(struct io_uring *ring, int fd) {
    struct io_uring_sqe *sqe = io_uring_get_sqe(ring);
    io_uring_prep_accept(sqe, fd, 0, 0, SOCK_NONBLOCK | SOCK_CLOEXEC);
    sqe->flags |= IOSQE_IO_LINK;
}

int setup_io_uring() {
    int ret = io_uring_queue_init(16, &ring, 0);
    if (ret) {
        fprintf(stderr, "Unable to setup io_uring: %s\n", strerror(-ret));
        return 1;
    }
    return 0;
}

int main(int argc, char *argv[]) {

    struct sockaddr_in serv_addr;

    setup_io_uring();
    
    int sock_listen_fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
    const int val = 1;
    setsockopt(sock_listen_fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));

    memset(&serv_addr, 0, sizeof(serv_addr));
    serv_addr.sin_family = AF_INET;
    serv_addr.sin_port = htons(PORT);
    serv_addr.sin_addr.s_addr = INADDR_ANY;

    if (bind(sock_listen_fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
         perror("Error binding socket\n");
         exit(1);
     }
    if (listen(sock_listen_fd, BACKLOG) < 0) {
         perror("Error listening on socket\n");
         exit(1);
    }

    setup_io_uring();

    add_poll(&ring, sock_listen_fd);
    add_accept(&ring, sock_listen_fd);
    io_uring_submit(&ring);

    
    while (1) {
        struct io_uring_cqe *cqe;
        io_uring_wait_cqe(&ring, &cqe);

    }

    io_uring_queue_exit(&ring);

    return 0;
}

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2020-08-17 10:18 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-12 17:58 io_uring process termination/killing is not working Josef
2020-08-12 18:05 ` Jens Axboe
2020-08-12 18:20   ` Pavel Begunkov
2020-08-12 18:22     ` Pavel Begunkov
2020-08-12 18:28       ` Pavel Begunkov
2020-08-12 23:32         ` Jens Axboe
2020-08-13 16:07           ` Josef
2020-08-13 16:09             ` Jens Axboe
2020-08-15  7:45           ` Pavel Begunkov
2020-08-15 15:12             ` Jens Axboe
2020-08-15 16:48               ` Pavel Begunkov
2020-08-15 21:43                 ` Josef
2020-08-15 22:35                   ` Jens Axboe
2020-08-15 23:21                     ` Josef
2020-08-15 23:31                     ` Jens Axboe
2020-08-16  0:36                       ` Josef
2020-08-16  0:41                         ` Jens Axboe
2020-08-16  1:21                           ` Jens Axboe
2020-08-16  3:14                             ` Josef
2020-08-16  3:20                               ` Jens Axboe
2020-08-16 17:30                                 ` Jens Axboe
2020-08-16 21:09                                   ` Josef
2020-08-16 22:17                                     ` Jens Axboe
2020-08-17  8:58                                       ` Josef
2020-08-17 10:08                                         ` Pavel Begunkov
2020-08-16 13:45                 ` Jens Axboe
2020-08-16 14:53                   ` Jens Axboe
2020-08-16 15:22                     ` Jens Axboe
2020-08-17 10:16                       ` Pavel Begunkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox