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

UT occasionally failed #19

Open
changweige opened this issue Nov 10, 2022 · 4 comments
Open

UT occasionally failed #19

changweige opened this issue Nov 10, 2022 · 4 comments

Comments

@changweige
Copy link
Contributor

test response::tests::test_set_server ... ok
test response::tests::test_status_code ... ok
test response::tests::test_write_response ... ok
test router::tests::test_create_router ... ok
test router::tests::test_handle_http_request ... ok
test connection::tests::test_try_read_split_ending ... ok
test server::tests::test_connection_size_limit_exceeded ... ok
test server::tests::test_set_payload_size ... ok
test connection::tests::test_try_read_long_headers ... ok
test server::tests::test_wait_in_flight_responses ... FAILED
test server::tests::test_wait_concurrent_connections ... ok
test server::tests::test_wait_many_connections ... ok
test server::tests::test_wait_one_connection ... ok
test server::tests::test_wait_one_fd_connection ... ok
test server::tests::test_wait_parse_error ... ok
test server::tests::test_large_payload ... ok
test server::tests::test_wait_expect_connection ... ok

failures:

---- server::tests::test_wait_in_flight_responses stdout ----
thread 'server::tests::test_wait_in_flight_responses' panicked at 'called Result::unwrap() on an Err value: Underflow', src/server.rs:1134:14
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

failures:
server::tests::test_wait_in_flight_responses

@wllenyj
Copy link
Contributor

wllenyj commented Nov 11, 2022

thread 'server::tests::test_wait_in_flight_responses' panicked at 'called Result::unwrap() on an Err value: Underflow', src/server.rs:1134:14

I see src/server.rs:1134 is in another test case, is it based on the master branch? Or can you remember the exact unwrap line?

@wllenyj
Copy link
Contributor

wllenyj commented Nov 11, 2022

I've added the call stack to fail in #20 , to be reproduced.

@changweige
Copy link
Contributor Author

thread 'server::tests::test_wait_in_flight_responses' panicked at 'called Result::unwrap() on an Err value: Underflow', src/server.rs:1134:14

I see src/server.rs:1134 is in another test case, is it based on the master branch? Or can you remember the exact unwrap line?

I suppose it's because the test result is printed with my patch applied which adds code lines to server.rs #18

@changweige
Copy link
Contributor Author

I re-ran the test on the latest main branch. Please check out the error message

running 13 tests
test src/common/headers.rs - common::headers::MediaType::as_str (line 414) ... ok
test src/common/mod.rs - common::Version (line 293) ... ok
test src/common/headers.rs - common::headers::MediaType::try_from (line 391) ... ok
test src/lib.rs - (line 47) ... ok
test src/common/headers.rs - common::headers::Encoding::try_from (line 325) ... ok
test src/common/headers.rs - common::headers::Headers::parse_header_line (line 130) ... ok
test src/common/mod.rs - common::Body (line 194) ... ok
test src/common/headers.rs - common::headers::Headers::try_from (line 263) ... ok
test src/request.rs - request::Request::try_from (line 184) ... ok
test src/lib.rs - (line 57) ... ok
test src/lib.rs - (line 83) ... ok
test src/router.rs - router::HttpRoutes<T>::handle_http_request (line 64) ... ok
test src/server.rs - server::HttpServer (line 251) ... FAILED

failures:

---- src/server.rs - server::HttpServer (line 251) stdout ----
Test executable failed (exit status: 101).

stderr:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: IOError(Os { code: 98, kind: AddrInUse, message: "Address already in use" })', src/server.rs:10:50
stack backtrace:
   0:     0x5565989f5a0d - std::backtrace_rs::backtrace::libunwind::trace::h8217d0a8f3fd2f41
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x5565989f5a0d - std::backtrace_rs::backtrace::trace_unsynchronized::h308103876b3af410
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x5565989f5a0d - std::sys_common::backtrace::_print_fmt::hc208018c6153605e
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x5565989f5a0d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf89a7ed694dfb585
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x556598a106ac - core::fmt::write::h21038c1382fe4264
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/fmt/mod.rs:1197:17
   5:     0x5565989f38f1 - std::io::Write::write_fmt::h7dbb1c9a3c254aef
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/io/mod.rs:1672:15
   6:     0x5565989f7095 - std::sys_common::backtrace::_print::h4e8889719c9ddeb8
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x5565989f7095 - std::sys_common::backtrace::print::h1506fe2cb3022667
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x5565989f7095 - std::panicking::default_hook::{{closure}}::hd9d7ce2a8a782440
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:295:22
   9:     0x5565989f6db6 - std::panicking::default_hook::h5b16ec25444b1b5d
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:314:9
  10:     0x5565989f7626 - std::panicking::rust_panic_with_hook::hb0138cb6e6fea3e4
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:698:17
  11:     0x5565989f7517 - std::panicking::begin_panic_handler::{{closure}}::h4cb67095557cd1aa
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:588:13
  12:     0x5565989f5ec4 - std::sys_common::backtrace::__rust_end_short_backtrace::h2bfcac279dcdc911
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:138:18
  13:     0x5565989f7249 - rust_begin_unwind
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:584:5
  14:     0x556598998603 - core::panicking::panic_fmt::h1de71520faaa17d3
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/panicking.rs:142:14
  15:     0x556598998693 - core::result::unwrap_failed::hc0baa33ef8bc7db8
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/result.rs:1805:5
  16:     0x556598999d04 - core::result::Result<T,E>::unwrap::h592a15e67aa6a779
  17:     0x55659899a953 - rust_out::main::_doctest_main_src_server_rs_251_0::h42eeaf24c076b129
  18:     0x55659899a8f6 - rust_out::main::heaf1d1c6cf89ad96
  19:     0x556598999953 - core::ops::function::FnOnce::call_once::h5b21711befc31851
  20:     0x556598998cb9 - std::sys_common::backtrace::__rust_begin_short_backtrace::h5f233326b8786c0e
  21:     0x556598999629 - std::rt::lang_start::{{closure}}::h52b0c5001fae4f75
  22:     0x5565989f14fe - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h4937aaa125c8d4b2
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/ops/function.rs:280:13
  23:     0x5565989f14fe - std::panicking::try::do_call::h6f5c70e8b0a34f92
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:492:40
  24:     0x5565989f14fe - std::panicking::try::h68766ba264ecf2e2
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:456:19
  25:     0x5565989f14fe - std::panic::catch_unwind::hc36033d2f9cc04af
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panic.rs:137:14
  26:     0x5565989f14fe - std::rt::lang_start_internal::{{closure}}::h78c037f4a1a28ded
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/rt.rs:128:48
  27:     0x5565989f14fe - std::panicking::try::do_call::he6e1fffda4c750ee
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:492:40
  28:     0x5565989f14fe - std::panicking::try::h48a77ddbb2f4c87a
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:456:19
  29:     0x5565989f14fe - std::panic::catch_unwind::hfa809b06a550a9e7
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panic.rs:137:14
  30:     0x5565989f14fe - std::rt::lang_start_internal::h4db69ed48eaca005
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/rt.rs:128:20
  31:     0x556598999611 - std::rt::lang_start::h20dea3d2ecba93b4
  32:     0x55659899acf3 - main
  33:     0x7f66f516b09b - __libc_start_main
                               at /build/glibc-fWwxX8/glibc-2.28/csu/../csu/libc-start.c:308:16
  34:     0x55659899889a - _start
  35:                0x0 - <unknown>



failures:
    src/server.rs - server::HttpServer (line 251)

test result: FAILED. 12 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.80s

error: test failed, to rerun pass '--doc'

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

No branches or pull requests

2 participants