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

Client hangs if it is running in the same process as the server (libiperf) #1785

Open
BlackPhantomCoder opened this issue Oct 16, 2024 · 0 comments

Comments

@BlackPhantomCoder
Copy link

Context

Using libiperf I run the client and server in the same process on localhost (in different threads) with the -R flag and at some point the client hangs. (Relatively random, in my example on 1-10 test)

  • Version of iperf3: 3.17.1
  • Operating system (and distribution, if any): Ubuntu 22.04.1

Bug Report

  • Expected Behavior
    Client does not hang

  • Actual Behavior
    Client hangs on some test

  • Steps to Reproduce
    A simple C++ program to reproduce (iperf_main is main from iperf itself)

void iperf_run(std::vector<std::string> args) {
  args.insert(args.begin(), "iperf"); // program name
  std::vector<char *> varg;
  std::transform(args.begin(), args.end(), std::back_inserter(varg),
                 [](auto &str) { return str.data(); });

  iperf_main(varg.size(), varg.data());
  std::cout << "done" << std::endl;
}

auto launch(std::vector<std::string> args) {
  return std::async(std::launch::async, iperf_run, std::move(args));
}

int main() {
  auto server = launch({"-s"});
  sleep(5);
  for (size_t i = 0; i != 100; ++i) {
    auto client = launch({"-c", "127.0.0.1", "-t", "1", "-R"});
  }
}
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

1 participant