0
votes

My program appears to run just fine most of the time, but occasionally I get a segmentation fault.

boost version = 1.41.0
running on RHEL 4
compiled with GCC 3.4.6

Backtrace:

#0  0x08138546 in boost::asio::detail::posix_fd_set_adapter::is_set (this=0xb74ed020, descriptor=-1)
    at /home/scottl/boost_1_41_0/boost/asio/detail/posix_fd_set_adapter.hpp:57
        __result = -1 'ÿ'
#1  0x0813e1b0 in boost::asio::detail::reactor_op_queue::perform_operations_for_descriptors (this=0x97f3b6c, descriptors=@0xb74ed020, result=@0xb74ecec8)
    at /home/scottl/boost_1_41_0/boost/asio/detail/reactor_op_queue.hpp:204
        op_iter = {_M_node = 0xb4169aa0}
        i = {_M_node = 0x97f3b74}
#2  0x081382ca in boost::asio::detail::select_reactor::run (this=0x97f3b08, block=true)
    at /home/scottl/boost_1_41_0/boost/asio/detail/select_reactor.hpp:388
        read_fds = {fd_set_ = {fds_bits = {16, 0 }}, max_descriptor_ = 65}
        write_fds = {fd_set_ = {fds_bits = {0 }}, max_descriptor_ = -1}
        retval = 1
        lock = { = {}, mutex_ = @0x97f3b1c, locked_ = true}
        except_fds = {fd_set_ = {fds_bits = {0 }}, max_descriptor_ = -1}
        max_fd = 65
        tv_buf = {tv_sec = 0, tv_usec = 710000}
        tv = (timeval *) 0xb74ecf88
        ec = {m_val = 0, m_cat = 0x81f2c24}
        sb = { = {}, blocked_ = true, old_mask_ = {__val = {0, 0, 134590223, 
      3075395548, 3075395548, 3075395464, 134729792, 3075395360, 135890240, 3075395368, 134593920, 3075395544, 135890240, 
      3075395384, 134599542, 3020998404, 135890240, 3075395400, 134614095, 3075395544, 4, 3075395416, 134548135, 3021172996, 
      4294967295, 3075395432, 134692921, 3075395504, 0, 3075395448, 134548107, 3021172992}}}
#3  0x0812eb45 in boost::asio::detail::task_io_service >::do_one (this=0x97f3a70, 
    lock=@0xb74ed230, this_idle_thread=0xb74ed240, ec=@0xb74ed2c0)
    at /home/scottl/boost_1_41_0/boost/asio/detail/task_io_service.hpp:260
        more_handlers = false
        c = {lock_ = @0xb74ed230, task_io_service_ = @0x97f3a70}
        h = (boost::asio::detail::handler_queue::handler *) 0x97f3aa0
        polling = false
        task_has_run = true
#4  0x0812765f in boost::asio::detail::task_io_service >::run (this=0x97f3a70, 
    ec=@0xb74ed2c0) at /home/scottl/boost_1_41_0/boost/asio/detail/task_io_service.hpp:103
        ctx = { = {}, owner_ = 0x97f3a70, next_ = 0x0}
        this_idle_thread = {wakeup_event = { = {}, cond_ = {__c_lock = {
        __status = 0, __spinlock = 22446}, __c_waiting = 0x2bd7, 
      __padding = "\000\000\000\000×+\000\000\000\000\000\000×+\000\000\000\000\000\000\204:\177\t\000\000\000", __align = 0}, 
    signalled_ = true}, next = 0x0}
        lock = { = {}, mutex_ = @0x97f3a84, locked_ = false}
        n = 11420
#5  0x08125e99 in boost::asio::io_service::run (this=0x97ebbcc) at /home/scottl/boost_1_41_0/boost/asio/impl/io_service.ipp:58
        ec = {m_val = 0, m_cat = 0x81f2c24}
        s = 8
#6  0x08154424 in boost::_mfi::mf0::operator() (this=0x9800870, p=0x97ebbcc)
    at /home/scottl/boost_1_41_0/boost/bind/mem_fn_template.hpp:49
No locals.
#7  0x08154331 in boost::_bi::list1 >::operator(), boost::_bi::list0> (this=0x9800878, f=@0x9800870, a=@0xb74ed337)
    at /home/scottl/boost_1_41_0/boost/bind/bind.hpp:236
No locals.
#8  0x081541e5 in boost::_bi::bind_t, boost::_bi::list1 > >::operator() (this=0x9800870) at /home/scottl/boost_1_41_0/boost/bind/bind_template.hpp:20
        a = {}
#9  0x08154075 in boost::detail::thread_data, boost::_bi::list1 > > >::run (this=0x98007a0)
    at /home/scottl/boost_1_41_0/boost/thread/detail/thread.hpp:56
No locals.
#10 0x0816fefd in thread_proxy () at /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/locale_facets.tcc:2443
        __ioinit = {static _S_refcount = , static _S_synced_with_stdio = }
---Type  to continue, or q  to quit---
        typeinfo for common::RuntimeException = {}
        typeinfo name for common::RuntimeException = "N6common16RuntimeExceptionE"
#11 0x00af23cc in start_thread () from /lib/tls/libpthread.so.0
No symbol table info available.
#12 0x00a5c96e in __init_misc () from /lib/tls/libc.so.6
No symbol table info available.
1

1 Answers

0
votes

Without seeing the code in question, I can only guess, but I've had asio crash on several occasions due to the object whose method has been passed (via boost::bind) to asio has been deleted before asio calls the method.