Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TcpStream read task does not return although data is available #1063

Open
@musli83

Description

@musli83

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 connectionlet socket = std::net::SocketAddrV4::new(addr, port);let stream = async_std::net::TcpStream::connect(socket).await?;// get writer and readerlet mut reader = stream.clone();let mut writer = stream;// spawn writterasync_std::task::spawn(async move {            Self::start_writer(&mut writer, cmd_rx, username, password, price_modify).await        });// set bufferlet 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp