Skip to content

Commit 577896f

Browse files
committed
debug hanging test
1 parent c6157d4 commit 577896f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
- uses: Swatinem/rust-cache@v2
8989

9090
- name: Test
91-
run: cargo test ${{ matrix.features }}
91+
run: cargo test ${{ matrix.features }} -- --nocapture
9292

9393
- name: Test all benches
9494
if: matrix.benches

tests/client.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2055,16 +2055,19 @@ mod conn {
20552055
.await
20562056
.expect("write 1");
20572057
let _ = done_rx.await;
2058+
eprintln!("bye server");
20582059
});
20592060

20602061
// make polling fair by putting both in spawns
20612062
tokio::spawn(async move {
2063+
eprintln!("client start");
20622064
let io = tcp_connect(&addr).await.expect("tcp connect");
20632065
let (mut client, conn) = conn::http1::Builder::new()
20642066
.handshake::<_, Empty<Bytes>>(io)
20652067
.await
20662068
.expect("http handshake");
20672069

2070+
eprintln!("client connected");
20682071
let mut conn = std::pin::pin!(conn);
20692072

20702073
// get the conn ready
@@ -2073,6 +2076,7 @@ mod conn {
20732076
.is_pending());
20742077
assert!(client.is_ready());
20752078

2079+
eprintln!("client send1");
20762080
// use the connection once
20772081
let mut fut1 = std::pin::pin!(client.send_request(http::Request::new(Empty::new())));
20782082
let _res1 = future::poll_fn(|cx| loop {
@@ -2089,32 +2093,37 @@ mod conn {
20892093

20902094
assert!(client.is_ready());
20912095

2096+
eprintln!("client trigger server end");
20922097
// simulate the server dropping the conn
20932098
let _ = done_tx.send(());
20942099
// let the server task die
20952100
// a full sleep might needed to make Windows happy
20962101
tokio::time::sleep(Duration::from_millis(10)).await;
2102+
eprintln!("client slept");
20972103

20982104
let mut fut2 =
20992105
std::pin::pin!(client.try_send_request(http::Request::new(Empty::new())));
21002106
let poll1 = future::poll_fn(|cx| Poll::Ready(fut2.as_mut().poll(cx))).await;
21012107
assert!(poll1.is_pending(), "not already known to error");
2108+
eprintln!("client try_send 2");
21022109

21032110
// wasn't a known error, req is in queue, and now the next poll, the
21042111
// conn will be noticed as errored
21052112
let mut err = future::poll_fn(|cx| {
21062113
loop {
2114+
eprintln!("client try_send poll loop");
21072115
if let Poll::Ready(res) = fut2.as_mut().poll(cx) {
21082116
return Poll::Ready(res);
21092117
}
21102118
match conn.as_mut().poll(cx) {
2111-
Poll::Ready(_) => continue, // ok
2119+
Poll::Ready(c) => { dbg!(c); }, // ok
21122120
Poll::Pending => return Poll::Pending,
21132121
};
21142122
}
21152123
})
21162124
.await
21172125
.expect_err("resp 2");
2126+
eprintln!("client error 2");
21182127

21192128
assert!(err.take_message().is_some(), "request was returned");
21202129
})

0 commit comments

Comments
 (0)