You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I have a strange bug that I am debugging for a few days now.
I am using async-std::net::TcpStream as part of a larger program like this:
// init socket and connection
let socket = std::net::SocketAddrV4::new(addr, port);
let stream = async_std::net::TcpStream::connect(socket).await?;
// get writer and reader
let mut reader = stream.clone();
let mut writer = stream;
// spawn writter
async_std::task::spawn(async move {
Self::start_writer(&mut writer, cmd_rx, username, password, price_modify).await
});
// set buffer
let mut buffer = bytes::BytesMut::with_capacity(8*1024);
// in loop read data and process it
loop {
println!("Read start");
let n = reader.read(&mut buffer).await?;
println!("Read end");
// do stuff with data
}
This code worked fine for months for multiple connections but now I am connecting to new server and it stops randomly after few seconds to minutes. Always hangs on the read call. - I get "Read start" printout but no "Read end".
When I check what is happening in wireshark I can see packets coming in and TCP receive window starts decreasing until zero window is reached.
Must be something timing related as if I add to much debug printouts it works for longer time or even doesn't halt at all
When I change code so I use std::net::TcpStream instead of async-std::net::TcpStream everything works fine.
Difference between new and old connections is that new one is direct connection to NY server from London. Previous ones go through local repeater in London. Otherwise type of data and connection is the same.
The text was updated successfully, but these errors were encountered:
Hi I have a strange bug that I am debugging for a few days now.
I am using async-std::net::TcpStream as part of a larger program like this:
This code worked fine for months for multiple connections but now I am connecting to new server and it stops randomly after few seconds to minutes. Always hangs on the read call. - I get "Read start" printout but no "Read end".
When I check what is happening in wireshark I can see packets coming in and TCP receive window starts decreasing until zero window is reached.
Must be something timing related as if I add to much debug printouts it works for longer time or even doesn't halt at all
When I change code so I use std::net::TcpStream instead of async-std::net::TcpStream everything works fine.
Difference between new and old connections is that new one is direct connection to NY server from London. Previous ones go through local repeater in London. Otherwise type of data and connection is the same.
The text was updated successfully, but these errors were encountered: