Stuck on #ZU2 in the Redis challenge with Zig and io_uring

UPDATE: I found the issue and was able to put a fix in place. If you’re curious about what was going on, check out this ChatGPT conversation: ChatGPT - Wait syscall signal handling. TL;DR: the tester was returning fine from the wait after killing my server, but that didn’t guarantee that the kernel had cleared up all of its internal data structures used to keep track of listening sockets. So, the listening socket for the Redis instance for the previous test was probably still lingering in the kernel and the next test was connecting to that one instead of the new one, and getting back a TCP RST upon sending the first command. Which also explains why waiting between tests helped mitigate this. I’ve added code to capture the SIGTERM sent by the tester to my program and a “cancel all” operation to my io_uring ring during cleanup, that seemed to do the trick :slightly_smiling_face:

Moral of the story is: cancel everything explicitly when using io_uring in your cleanup code, and make sure your cleanup code runs even if your program is terminated by a signal. Oh, and never give up of course :grin:

2 Likes