zedio icon indicating copy to clipboard operation
zedio copied to clipboard

tcp_socket_test will trigger a coredump when calling the destructor of `FD`.

Open acking-you opened this issue 8 months ago • 0 comments

Issue

In tcp_socket_test, the TcpSocket is used, but this socket exists outside the entire runtime. The t_ring is not initialized, which leads to a null pointer coredump when its method is called in do_close:

https://github.com/8sileus/zedio/blob/74d312f0ba178f0fdeba0dabf74699c68a170e0f/zedio/io/io.hpp#L111

At the same time, some design flaws were discovered. Since TcpSocket was not set as noncopyable, multiple sockets inadvertently shared the same fd (as in the aforementioned test), which eventually led to multiple close calls on the same fd.

What I am doing

Thank you very much for the library you've written. I've recently been trying to learn C++20 coroutines, and I'm also very interested in the implementation of tokio in Rust. Currently, I'm studying your library in my spare time. I've forked a corresponding repository, unified the package management using vcpkg, and switched the testing framework to ut (a C++20 unit testing framework). fork repo

acking-you avatar Aug 10 '25 09:08 acking-you