Skip to content
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

Fix: build and tests on FreeBSD 13.2 #1555

Merged
merged 5 commits into from
May 6, 2023

Conversation

Tirka
Copy link
Contributor

@Tirka Tirka commented May 6, 2023

Currently main branch does not compile on FreeBSD 13.2

build log
   Compiling quinn-proto v0.10.0 (/usr/home/maksimv/quinn/quinn-proto)
   Compiling quinn-udp v0.4.0 (/usr/home/maksimv/quinn/quinn-udp)
   Compiling clap v3.2.25
   Compiling serde v1.0.162
error[E0425]: cannot find value `SYS_sendmmsg` in crate `libc`
    --> quinn-udp/src/unix.rs:319:35
     |
319  |       let ret = libc::syscall(libc::SYS_sendmmsg, sockfd, msgvec, vlen, flags) as libc::c_int;
     |                                     ^^^^^^^^^^^^ help: a function with a similar name exists: `sendmmsg`
     |
    ::: /home/maksimv/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.142/src/unix/bsd/freebsdlike/freebsd/mod.rs:5162:5
     |
5162 | /     pub fn sendmmsg(
5163 | |         sockfd: ::c_int,
5164 | |         msgvec: *mut ::mmsghdr,
5165 | |         vlen: ::size_t,
5166 | |         flags: ::c_int,
5167 | |     ) -> ::ssize_t;
     | |__________________- similarly named function `sendmmsg` defined here

error[E0425]: cannot find value `SYS_recvmmsg` in crate `libc`
    --> quinn-udp/src/unix.rs:432:29
     |
432  |           libc::syscall(libc::SYS_recvmmsg, sockfd, msgvec, vlen, flags, timeout) as libc::c_int;
     |                               ^^^^^^^^^^^^ help: a function with a similar name exists: `recvmmsg`
     |
    ::: /home/maksimv/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.142/src/unix/bsd/freebsdlike/freebsd/mod.rs:5168:5
     |
5168 | /     pub fn recvmmsg(
5169 | |         sockfd: ::c_int,
5170 | |         msgvec: *mut ::mmsghdr,
5171 | |         vlen: ::size_t,
5172 | |         flags: ::c_int,
5173 | |         timeout: *const ::timespec,
5174 | |     ) -> ::ssize_t;
     | |__________________- similarly named function `recvmmsg` defined here

error[E0308]: mismatched types
   --> quinn-udp/src/unix.rs:352:29
    |
352 |         (*msgvec).msg_len = n as libc::c_uint;
    |         -----------------   ^^^^^^^^^^^^^^^^^ expected `isize`, found `u32`
    |         |
    |         expected due to the type of this binding

error[E0308]: mismatched types
   --> quinn-udp/src/unix.rs:465:29
    |
465 |         (*msgvec).msg_len = n as libc::c_uint;
    |         -----------------   ^^^^^^^^^^^^^^^^^ expected `isize`, found `u32`
    |         |
    |         expected due to the type of this binding

Some errors have detailed explanations: E0308, E0425.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `quinn-udp` due to 4 previous errors
warning: build failed, waiting for other jobs to finish...

Looks like FreeBSD implements recvmmsg and sendmmsg as high-level abstractions over recvmsg and sendmsg and not as direct system calls.

This Pull Requests resolves issue by calling recvmmsg/sendmmsg directly if target_os = "freebsd"

build and test log
➜  quinn git:(build-and-tests-freebsd-13.2) cargo build
   Compiling quinn-udp v0.4.0 (/usr/home/maksimv/quinn/quinn-udp)
   Compiling serde_json v1.0.96
   Compiling quinn v0.10.0 (/usr/home/maksimv/quinn/quinn)
   Compiling perf v0.1.0 (/usr/home/maksimv/quinn/perf)
   Compiling bench v0.1.0 (/usr/home/maksimv/quinn/bench)
    Finished dev [unoptimized + debuginfo] target(s) in 3.07s

➜  quinn git:(build-and-tests-freebsd-13.2) cargo test
   Compiling pin-project-internal v1.0.12
   Compiling unicode-normalization v0.1.22
   Compiling percent-encoding v2.2.0
   Compiling unicode-bidi v0.3.13
   Compiling dirs-sys-next v0.1.2
   Compiling crc-catalog v2.2.0
   Compiling bencher v0.1.5
   Compiling hex-literal v0.4.1
   Compiling assert_matches v1.5.0
   Compiling bench v0.1.0 (/usr/home/maksimv/quinn/bench)
   Compiling perf v0.1.0 (/usr/home/maksimv/quinn/perf)
   Compiling crc v3.0.1
   Compiling quinn-proto v0.10.0 (/usr/home/maksimv/quinn/quinn-proto)
   Compiling form_urlencoded v1.1.0
   Compiling directories-next v2.0.0
   Compiling quinn-udp v0.4.0 (/usr/home/maksimv/quinn/quinn-udp)
   Compiling idna v0.3.0
   Compiling url v2.3.1
   Compiling pin-project v1.0.12
   Compiling tracing-futures v0.2.5
   Compiling quinn v0.10.0 (/usr/home/maksimv/quinn/quinn)
    Finished test [unoptimized + debuginfo] target(s) in 6.74s
     Running unittests src/lib.rs (target/debug/deps/bench-ceeeb7873258cb39)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/bin/bulk.rs (target/debug/deps/bulk-0be315f4c5d52962)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/lib.rs (target/debug/deps/perf-287db6662727b10d)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/bin/perf_client.rs (target/debug/deps/perf_client-66fee0e3732847de)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/bin/perf_server.rs (target/debug/deps/perf_server-3f22b6c9cef581ba)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/lib.rs (target/debug/deps/quinn-df0c7e4127e9d912)

running 16 tests
test tests::local_addr ... ok
test tests::close_endpoint ... ok
test tests::export_keying_material ... ok
test tests::stream_id_flow_control ... ok
test work_limiter::tests::limit_work ... ok
test tests::rebind_recv ... ok
test tests::two_datagram_readers ... ok
test tests::echo_v4 ... ok
test tests::echo_v6 ... ok
test tests::zero_rtt ... ok
test tests::accept_after_close ... ok
test tests::read_after_close ... ok
test tests::handshake_timeout ... ok
test tests::stress_stream_receive_window ... ok
test tests::stress_receive_window ... ok
test tests::stress_both_windows ... ok

test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 17.28s

     Running tests/many_connections.rs (target/debug/deps/many_connections-eb299f32f11e8ded)

running 1 test
test connect_n_nodes_to_1_and_send_1mb_data ... ignored

test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/lib.rs (target/debug/deps/quinn_proto-a984d5bd60ce9091)

running 190 tests
test cid_queue::tests::always_valid ... ok
test cid_queue::tests::insert_duplicate ... ok
test cid_queue::tests::next_dense ... ok
test cid_queue::tests::insert_retired ... ok
test cid_queue::tests::retire_many ... ok
test cid_queue::tests::insert_limit ... ok
test cid_queue::tests::retire_sparse ... ok
test cid_queue::tests::next_sparse ... ok
test cid_queue::tests::retire_then_insert_next ... ok
test cid_queue::tests::retire_dense ... ok
test cid_queue::tests::wrap ... ok
test congestion::bbr::min_max::test::test ... ok
test connection::assembler::test::assemble_complex ... ok
test connection::assembler::test::assemble_contained ... ok
test connection::assembler::test::assemble_complex_compact ... ok
test connection::assembler::test::assemble_contained_compact ... ok
test connection::assembler::test::assemble_contains ... ok
test connection::assembler::test::assemble_contains_compact ... ok
test connection::assembler::test::assemble_duplicate ... ok
test connection::assembler::test::assemble_duplicate_compact ... ok
test connection::assembler::test::assemble_ordered ... ok
test connection::assembler::test::assemble_overlapping ... ok
test connection::assembler::test::chunks_dedup ... ok
test connection::assembler::test::assemble_overlapping_compact ... ok
test connection::assembler::test::assemble_old ... ok
test connection::assembler::test::compact ... ok
test connection::assembler::test::defrag_read_chunk ... ok
test connection::assembler::test::unordered_happy_path ... ok
test connection::assembler::test::ordered_insert_unordered_read ... ok
test connection::mtud::tests::black_hole_detector_ignores_burst_containing_non_suspicious_packet ... ok
test connection::assembler::test::assemble_unordered ... ok
test connection::mtud::tests::black_hole_detector_ignores_empty_burst ... ok
test connection::mtud::tests::black_hole_detector_counts_burst_containing_only_suspicious_packets ... ok
test connection::mtud::tests::mtu_discovery_disabled_does_nothing ... ok
test connection::assembler::test::ordered_eager_discard ... ok
test connection::mtud::tests::mtu_discovery_lost_half_of_probes_finds_maximum_udp_payload ... ok
test connection::mtud::tests::mtu_discovery_after_complete_reactivates_when_interval_elapsed ... ok
test connection::mtud::tests::mtu_discovery_disabled_lost_four_packet_bursts_triggers_black_hole_detection ... ok
test connection::mtud::tests::mtu_discovery_lost_four_packet_bursts_triggers_black_hole_detection_and_resets_timer ... ok
test connection::assembler::test::defrag_with_missing_prefix ... ok
test connection::assembler::test::unordered_dedup ... ok
test connection::mtud::tests::mtu_discovery_lost_three_probes_lowers_probe_size ... ok
test connection::mtud::tests::mtu_discovery_no_lost_probes_finds_maximum_udp_payload ... ok
test connection::mtud::tests::mtu_discovery_with_1500_limit_and_10000_upper_bound ... ok
test connection::mtud::tests::mtu_discovery_with_1500_limit ... ok
test connection::mtud::tests::mtu_discovery_lost_two_packet_bursts_does_not_trigger_black_hole_detection ... ok
test connection::mtud::tests::mtu_discovery_with_previous_peer_max_udp_payload_size_clamps_upper_bound ... ok
test connection::mtud::tests::mtu_discovery_with_peer_max_udp_payload_size_clamps_upper_bound ... ok
test connection::mtud::tests::search_state_lower_bound_higher_than_peer_max_udp_payload_size_clamps_lower_bound ... ok
test connection::mtud::tests::search_state_lower_bound_higher_than_upper_bound_clamps_upper_bound ... ok
test connection::mtud::tests::search_state_upper_bound_higher_than_peer_max_udp_payload_size_clamps_upper_bound ... ok
test connection::pacing::tests::adjusts_capacity ... ok
test connection::mtud::tests::mtu_discovery_with_peer_max_udp_payload_size_after_search_panics - should panic ... ok
test connection::pacing::tests::does_not_panic_on_bad_instant ... ok
test connection::pacing::tests::derives_initial_capacity ... ok
test connection::pacing::tests::computes_pause_correctly ... ok
test connection::send_buffer::tests::retransmit ... ok
test connection::send_buffer::tests::fragment_with_length ... ok
test connection::send_buffer::tests::ack ... ok
test connection::send_buffer::tests::reordered_ack ... ok
test connection::send_buffer::tests::fragment_without_length ... ok
test connection::spaces::test::sanity ... ok
test connection::spaces::test::jump ... ok
test connection::send_buffer::tests::multiple_segments ... ok
test connection::spaces::test::sent_packet_size ... ok
test connection::streams::send::tests::byte_slice ... ok
test connection::streams::send::tests::bytes_array ... ok
test connection::send_buffer::tests::reserves_encoded_offset ... ok
test connection::streams::state::tests::expand_receive_window ... ok
test connection::spaces::test::happypath ... ok
test connection::streams::state::tests::final_offset_flow_control ... ok
test connection::streams::state::tests::send_stopped ... ok
test connection::streams::state::tests::remote_stream_capacity ... ok
test connection::streams::state::tests::reset_stream_cannot_send ... ok
test connection::streams::state::tests::requeue_stream_priority ... ok
test connection::streams::state::tests::stopped_reset ... ok
test connection::streams::state::tests::recv_stopped ... ok
test connection::streams::state::tests::stop_finished ... ok
test connection::streams::state::tests::reset_flow_control ... ok
test connection::streams::state::tests::stream_limit_fixed ... ok
test connection::streams::state::tests::stream_limit_grows ... ok
test connection::streams::state::tests::reset_after_empty_frame_flow_control ... ok
test frame::test::ack_coding ... ok
test connection::streams::state::tests::stream_priority ... ok
test connection::streams::state::tests::duplicate_reset_flow_control ... ok
test connection::streams::state::tests::trivial_flow_control ... ok
test packet::tests::pn_encode ... ok
test packet::tests::roundtrip_packet_numbers ... ok
test packet::tests::header_encoding ... ok
test range_set::btree_range_set::tests::replace_contained ... ok
test range_set::btree_range_set::tests::replace_exact_pred ... ok
test connection::streams::state::tests::shrink_receive_window ... ok
test range_set::btree_range_set::tests::replace_contains ... ok
test connection::streams::state::tests::stream_limit_shrinks ... ok
test range_set::tests::array_range_set::double_merge_wide ... ok
test range_set::btree_range_set::tests::replace_pred ... ok
test range_set::btree_range_set::tests::replace_exact_succ ... ok
test range_set::btree_range_set::tests::replace_succ ... ok
test range_set::tests::array_range_set::double_remove ... ok
test range_set::tests::array_range_set::insert_multiple ... ok
test range_set::tests::array_range_set::double_insert ... ok
test range_set::tests::array_range_set::double_merge_exact ... ok
test range_set::tests::array_range_set::single_merge_low ... ok
test range_set::tests::array_range_set::remove_multiple ... ok
test range_set::tests::array_range_set::skip_empty_ranges ... ok
test range_set::tests::array_range_set::single_merge_high ... ok
test range_set::tests::range_set::double_insert ... ok
test range_set::tests::array_range_set::merge_and_split ... ok
test range_set::tests::range_set::double_merge_wide ... ok
test range_set::tests::range_set::double_merge_exact ... ok
test range_set::tests::range_set::double_remove ... ok
test range_set::tests::range_set::single_merge_high ... ok
test range_set::tests::range_set::insert_multiple ... ok
test range_set::tests::range_set::merge_and_split ... ok
test range_set::tests::range_set::remove_multiple ... ok
test range_set::tests::range_set::single_merge_low ... ok
test range_set::tests::range_set::skip_empty_ranges ... ok
test tests::client_alpn_unset ... ok
test tests::alpn_mismatch ... ok
test tests::concurrent_connections_full ... ok
test tests::alpn_success ... ok
test packet::tests::pn_expand_roundtrip ... ok
test tests::blackhole_after_mtu_change_repairs_itself ... ok
test tests::conn_flow_control ... ok
test tests::client_stateless_reset ... ok
test tests::congested_tail_loss ... ok
test tests::connect_too_low_mtu ... ok
test tests::cid_retirement ... ok
test range_set::tests::array_range_set::compare_insert_to_reference ... ok
test tests::cid_rotation ... ok
test tests::connect_runs_mtud_again_after_600_seconds ... ok
test tests::congestion ... ok
test tests::datagram_recv_buffer_overflow ... ok
test tests::connection_close_sends_acks ... ok
test tests::datagram_unsupported ... ok
test tests::connect_lost_mtu_probes_do_not_trigger_congestion_control ... ok
test range_set::tests::range_set::compare_insert_to_reference ... ok
test tests::export_keying_material ... ok
test tests::handshake_anti_deadlock_probe ... ok
test tests::datagram_send_recv ... ok
test range_set::tests::array_range_set::compare_remove_to_reference ... ok
test tests::draft_version_compat ... ok
test tests::connect_detects_mtu ... ok
test tests::finish_stream_flow_control_reordered ... ok
test tests::instant_close_1 ... ok
test tests::finish_retransmit ... ok
test tests::finish_stream_simple ... ok
test tests::instant_close_2 ... ok
test tests::idle_timeout ... ok
test tests::malformed_token_len ... ok
test tests::finish_acked ... ok
test tests::large_initial ... ok
test tests::handshake_1rtt_handling ... ok
test tests::high_latency_handshake ... ok
test tests::key_update_simple ... ok
test tests::implicit_open ... ok
test tests::initial_retransmit ... ok
test tests::lifecycle ... ok
test tests::key_update_reordered ... ok
test tests::migrate_detects_new_mtu_and_respects_original_peer_max_udp_payload_size ... ok
test tests::packet_splitting_not_necessary_after_higher_mtu_discovered ... ok
test tests::reject_self_signed_server_cert ... ok
test tests::server_alpn_unset ... ok
test tests::packet_splitting_with_default_mtu ... ok
test tests::packet_loss_and_retry_too_low_mtu ... ok
test tests::reject_missing_client_cert ... ok
test range_set::tests::range_set::compare_remove_to_reference ... ok
test tests::repeated_request_response ... ok
test tests::reset_stream ... ok
test tests::server_can_send_3_inital_packets ... ok
test tests::migration ... ok
test tests::version_negotiate_client ... ok
test tests::version_negotiate_server ... ok
test tests::keep_alive ... ok
test tests::stop_before_finish ... ok
test token::test::invalid_token_returns_err ... ok
test token::test::token_sanity ... ok
test transport_parameters::test::coding ... ok
test transport_parameters::test::resumption_params_validation ... ok
test tests::stop_during_finish ... ok
test tests::stateless_retry ... ok
test tests::stream_id_limit ... ok
test tests::server_hs_retransmit ... ok
test tests::server_stateless_reset ... ok
test tests::stop_opens_bidi ... ok
test tests::stream_flow_control ... ok
test tests::stop_stream ... ok
test tests::zero_rtt_rejection ... ok
test tests::zero_length_cid ... ok
test tests::zero_rtt_happypath ... ok

test result: ok. 190 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.17s

     Running unittests src/lib.rs (target/debug/deps/quinn_udp-6337c310b84b504d)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests bench

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests perf

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests quinn

running 1 test
test src/recv_stream.rs - recv_stream::RecvStream (line 40) - compile ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s

   Doc-tests quinn-proto

running 3 tests
test src/config.rs - config::TransportConfig::congestion_controller_factory (line 282) ... ok
test src/config.rs - config::IdleTimeout (line 843) ... ok
test src/config.rs - config::TransportConfig::max_idle_timeout (line 79) ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.16s

   Doc-tests quinn-udp

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

➜  quinn git:(build-and-tests-freebsd-13.2) uname -a
Linux bsdvm 4.4.0 FreeBSD 13.2-RELEASE releng/13.2-n254617-525ecfdad597 GENERIC x86_64 x86_64 x86_64 GNU/Linux

@djc
Copy link
Member

djc commented May 6, 2023

So why didn't our FreeBSD run in CI catch this?

quinn-udp/src/unix.rs Outdated Show resolved Hide resolved
@Tirka
Copy link
Contributor Author

Tirka commented May 6, 2023

So why didn't our FreeBSD run in CI catch this?

FreeBSD CI environment emits build errors, but does not mark Action as failed: #1556. Will try to investigate further

@Tirka Tirka requested a review from Ralith May 6, 2023 15:41
quinn-udp/src/unix.rs Show resolved Hide resolved
@Ralith Ralith merged commit aeda2e2 into quinn-rs:main May 6, 2023
@Tirka Tirka deleted the build-and-tests-freebsd-13.2 branch May 6, 2023 18:47
@djc djc mentioned this pull request May 8, 2023
3 tasks
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.

3 participants