Skip to content

(feat) Use poll instead of select for tcp connections #176

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

Merged
merged 1 commit into from
Jun 25, 2019

Conversation

killme2008
Copy link
Contributor

Use poll to replace select for creating a TCP connection on *nix platform, fixed rust-lang/libc#1401

Because select has an upper limit as FD_SETSIZE, and if the process has many file descriptors, it will panic at

fd_set.insert(socket_fd);

The backtrace:

0:     0x55d9ba51486d - backtrace::backtrace::libunwind::trace::h5d5f7561c1a9102a
                        at /root/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/backtrace-0.2.3/src/backtrace/libunwind.rs:54
                         - backtrace::backtrace::trace::h1a0e9cf6143fd38a
                        at /root/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/backtrace-0.2.3/src/backtrace/mod.rs:70
   1:     0x55d9ba514512 - backtrace::capture::Backtrace::new::h5f5871afa8f4b8c8
                        at /var/lib/docker/volumes/jenkins-slave-2/_data/workspace/ceresdb.datanode/target/release/build/backtrace-885d76ac7e31444c/out/capture.rs:79- <backtrace::capture::Backtrace as core::default::Default>::default::hebc8b9531935d674
                        at /var/lib/docker/volumes/jenkins-slave-2/_data/workspace/ceresdb.datanode/target/release/build/backtrace-885d76ac7e31444c/out/capture.rs:187 cse::engine::util::set_exit_hook::{{closure}}::ha6e6efad2fa08800
                        at src/engine/util/mod.rs:148
   3:     0x55d9ba5e78c9 - std::panicking::rust_panic_with_hook::h744417edfe714d72
                        at src/libstd/panicking.rs:482
   4:     0x55d9ba5e7371 - std::panicking::continue_panic_fmt::h3557b3c3fa21b47b
                        at src/libstd/panicking.rs:385
   5:     0x55d9ba5e7255 - rust_begin_unwind
                        at src/libstd/panicking.rs:312
   6:     0x55d9ba60224c - core::panicking::panic_fmt::h74ee8034b317ceed
                        at src/libcore/panicking.rs:85
   7:     0x55d9ba602200 - core::panicking::panic_bounds_check::h34b80e64d41db052
                        at src/libcore/panicking.rs:61
   8:     0x55d9ba3ee631 - libc::unix::notbsd::FD_SET::ha619521f92708798
                        at /root/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/libc-0.2.58/src/unix/notbsd/mod.rs:1177
                         - nix::sys::select::FdSet::insert::h098df705361b8e98
                        at /root/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/nix-0.11.1/src/sys/select.rs:26
   9:     0x55d9ba0eed63 - mysql::io::tcp::connect_fd_timeout::hd42bf0ea22ab5998

@blackbeam blackbeam merged commit 9cbe86d into blackbeam:master Jun 25, 2019
@blackbeam
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic at FD_SET
2 participants