Opened 8 years ago
Last modified 6 years ago
#10447 new Bugs
io_service destructor hangs if serial_port read is queued, even if not running
| Reported by: | Owned by: | chris_kohlhoff | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | asio |
| Version: | Boost 1.55.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
The following program does not terminate.
#include <boost/asio.hpp>
int main() {
auto* ios = new boost::asio::io_service;
auto* port = new boost::asio::serial_port(*ios);
port->open("COM6");
char c;
boost::asio::async_read(*port, boost::asio::buffer(&c, 1), [](boost::system::error_code, int) {});
delete ios;
}
Despite the fact that the io_service is not running, its destructor hangs if there is a pending async_read from a serial_port. If that read completes (by receiving one byte), the program terminates.
Change History (3)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
| Component: | None → asio |
|---|---|
| Owner: | set to |
comment:3 by , 6 years ago
User error: objects dependent on an io_service should be destroyed prior to that io_service's destruction.
Note:
See TracTickets
for help on using tickets.

Oh, I can only reproduce this on Windows.