boostorg / boostorg/process

Deadlock when using async input and pipes.

Open
#64 23 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
145
Forks
151
PR merge metrics
No merged PRs in 30d

Description

Should this work, or is there a bug in what I'm doing? With the latest code on github, the following program hangs:

```
std::string data = "some data to send to cat";
std::future result;
boost::asio::io_service ios;
bp::pipe p;
bp::spawn("cat", bp::std_in < bp::buffer(data), bp::std_out > p, ios);
bp::spawn("cat", bp::std_in < p, bp::std_out > result, ios);

// run blocks forever.
ios.run();
std::cout << result.get() << std::endl;
```

This seems like something that ought to work. Also, these two other programs that are only a little different work as expected, making it seem like there might be a bug in the interaction between multiple processes participating in a pipeline and the use of async input:
```
// use echo to make data instead of bp::buffer()
std::future result;
boost::asio::io_service ios;
bp::pipe p1,p2;
bp::spawn("echo -n some data to send to cat", bp::std_out > p1);
bp::spawn("cat", bp::std_in < p1, bp::std_out > p2);
bp::spawn("cat", bp::std_in < p2, bp::std_out > result, ios);

ios.run();
std::cout << result.get() << std::endl;

```

```
// When pipes aren't used everything also works as expected.
std::string data = "some data to send to cat";
std::future result;
boost::asio::io_service ios;
bp::spawn("cat", bp::std_in < bp::buffer(data), bp::std_out > result, ios);

ios.run();
std::cout << result.get() << std::endl;
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.