Boost logo

Boost :

Subject: Re: [boost] async_read SEGFAULT
From: Richard Hodges (hodges.r_at_[hidden])
Date: 2019-01-05 17:56:04

Not enough data here to help you I'm afraid.

You may want to post the question (with MVCE) on

Some questions spring to mind:

1. do you ensure the lifetime of the receive/send buffers during async
2. are you using strands? If so are you binding your async handlers to the
3. How are you managing the lifetimes of your server and connection
objects? Did you remember to capture shared_ptrs (for example) in the async

On Sat, 5 Jan 2019 at 10:34, hh h via Boost <boost_at_[hidden]> wrote:

> I use one io_service in one process to run two servers A and B each
> has its own port, own context and SSL configuration to accept inbound
> connections. Although both A and B have
> boost::asio::deadline_timer, but I think there is only one thread is
> running:
> (gdb) info threads
> Id Target Id Frame
> * 1 Thread 0x7ffff7fe0bc0 (LWP 31204) "ssl_connection"
> 0x00007ffff4a690a3 in __epoll_wait_nocancel () at
> ../sysdeps/unix/syscall-template.S:84
> The problem I got:
> - If I started only one server A, it worked just fine for both
> async_read and async_write.
> - If I started both servers A and B, even B was in idle, server A
> could sometime be crashed after receiving and responding just one
> message, then crashed at next async_read in the first second, it was
> more stable if it did not call async_write.
> SEGFAULT: Fault address=0x55b3700d00cf,
> #4 0x000055555557f98a in
> boost::asio::detail::task_io_service_operation::complete
> (this=0x55555584adc0, owner=..., ec=..., bytes_transferred=0)
> at /usr/include/boost/asio/detail/task_io_service_operation.hpp:38
> #5 0x0000555555581f82 in boost::asio::detail::task_io_service::do_run_one
> (
> this=0x555555814710, lock=..., this_thread=..., ec=...)
> at /usr/include/boost/asio/detail/impl/task_io_service.ipp:372
> #6 0x0000555555581ab4 in boost::asio::detail::task_io_service::run (
> this=0x555555814710, ec=...)
> at /usr/include/boost/asio/detail/impl/task_io_service.ipp:149
> #7 0x000055555558221f in boost::asio::io_service::run
> (this=0x7fffffffe150)
> at /usr/include/boost/asio/impl/io_service.ipp:59
> It seems that async_write and async_read messed up, but that problem
> was intermittent, especially when the server A passed first second, it
> could be running for hours for doing consequent many async_read and
> async_write simultaneously. It was only one thread, what could cause
> that problem?
> Thank you.
> _______________________________________________
> Unsubscribe & other changes:

Richard Hodges
office: +442032898513
home: +376841522
mobile: +376380212 (this will be *expensive* outside Andorra!)
skype: madmongo
facebook: hodges.r

Boost list run by bdawes at, gregod at, cpdaniel at, john at