Boost logo

Boost Users :

Subject: [Boost-users] Segmentation fault when using asio and poll_one
From: Allan Nielsen (a_at_[hidden])
Date: 2011-08-09 12:12:40


Hi

I'm using Boost 1.46.1 asio for doing serial communication.

About 1/1000 times when I run the poll_one I get this segmentation fault:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000434a7a in boost::asio::detail::reactor_op::perform
(this=0x402010af1010004) at
/usr/include/boost-1_46/boost/asio/detail/reactor_op.hpp:40
40 return perform_func_(this);
(gdb) bt
#0 0x0000000000434a7a in boost::asio::detail::reactor_op::perform
(this=0x402010af1010004) at
/usr/include/boost-1_46/boost/asio/detail/reactor_op.hpp:40
#1 0x0000000000435da6 in boost::asio::detail::epoll_reactor::run
(this=0x6625c0, block=false, ops=...) at
/usr/include/boost-1_46/boost/asio/detail/impl/epoll_reactor.ipp:286
#2 0x0000000000436a24 in boost::asio::detail::task_io_service::do_one
(this=0x6624e0, lock=..., this_idle_thread=0x0) at
/usr/include/boost-1_46/boost/asio/detail/impl/task_io_service.ipp:264
#3 0x0000000000436612 in
boost::asio::detail::task_io_service::poll_one (this=0x6624e0, ec=...)
at /usr/include/boost-1_46/boost/asio/detail/impl/task_io_service.ipp:188
#4 0x0000000000436e65 in boost::asio::io_service::poll_one
(this=0x7fffffffe240, ec=...) at
/usr/include/boost-1_46/boost/asio/impl/io_service.ipp:103
#5 0x000000000043b69b in CcTalkPort::receive (this=0x7fffffffe240) at
/home/awn/git/gamblify/hardware/gmbio/software/test/ccTalkScan.cxx:382
#6 0x000000000043b7dc in CcTalkPort::receive (this=0x7fffffffe240,
size=5) at /home/awn/git/gamblify/hardware/gmbio/software/test/ccTalkScan.cxx:396
#7 0x000000000043bcb5 in CcTalkPort::_ask (this=0x7fffffffe240,
req=...) at /home/awn/git/gamblify/hardware/gmbio/software/test/ccTalkScan.cxx:411
#8 0x000000000043ac6e in CcTalkPort::ask (this=0x7fffffffe240,
req=...) at /home/awn/git/gamblify/hardware/gmbio/software/test/ccTalkScan.cxx:317
#9 0x000000000043daef in CcTalkDevice::ask_hex (this=0x7fffffffe300,
v=..., m=..., s=...) at
/home/awn/git/gamblify/hardware/gmbio/software/test/ccTalkScan.cxx:583
#10 0x000000000043ce69 in CcTalkDevice::request_software_revision
(this=0x7fffffffe300) at
/home/awn/git/gamblify/hardware/gmbio/software/test/ccTalkScan.cxx:507
#11 0x000000000043c57f in CcTalkDevice::coreInfo (this=0x7fffffffe300)
at /home/awn/git/gamblify/hardware/gmbio/software/test/ccTalkScan.cxx:459
#12 0x00000000004325ff in main (argc=1, argv=0x7fffffffe528) at
/home/awn/git/gamblify/hardware/gmbio/software/test/ccTalkScan.cxx:820

Here is the snippet where I call it:

            while(1) {
                io_service.reset();
                io_service.poll_one(ec);

                if ( read_result ) {
                    timer.cancel();
                    return;

                } else if ( timer_result ) {
                    throw CcTalkTimeOutException();
                }
            }

Any hints on how to debug this?

--
Allan W. Nielsen

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net