Opened 13 years ago

Closed 13 years ago

#3036 closed Bugs (invalid)

Segmentation fault at boost::asio

Reported by: elod.biro@… Owned by: chris_kohlhoff
Milestone: Component: asio
Version: Boost 1.34.0 Severity: Problem
Keywords: segmentation fault boost::asio Cc:

Description

We use the boost 1.33.1 version and we are upgrading the boost to 1.39.0.

We use the boost to handle the network connection in our software. Sometimes the program crashes, but we dont know exactly in what cases these are. When the program crashes, the result of the core analyses always the same:

Program terminated with signal 11, Segmentation fault.

#0 0x081c19c5 in dispatch<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf6<void, Ccdt_TcpHandler, INT16U, INT32U, INT32U, INT32U, Ccdt_TcpMessageWrite*, const boost::asio::error&>, boost::_bi::list7<boost::_bi::value<Ccdt_TcpHandler*>, boost::_bi::value<short unsigned int>, boost::_bi::value<long unsigned int>, boost::_bi::value<long unsigned int>, boost::_bi::value<long unsigned int>, boost::_bi::value<Ccdt_TcpMessageWrite*>, boost::arg<1> > >, boost::asio::error, unsigned int> > (

this=0x1d, handler=

{handler_ = {f_ = {f_ = 0x81a8f66 <Ccdt_TcpHandler::handleWrite(unsigned short, unsigned long, unsigned long, unsigned long, Ccdt_TcpMessageWrite*, boost::asio::error const&)>}, l_ = {a1_ = {t_ = 0xb212dbb8}, a2_ = {t_ = 10024}, a3_ = {t_ = 78164}, a4_ = {t_ = 4}, a5_ = {t_ = 0}, a6_ = {t_ = 0xb1f15210}, a7_ = {<No data fields>}}}, arg1_ = {<> = {<No data fields>}, code_ = 125, what_ = {ptr = 0x0}}, arg2_ = 0}) at /usr/trading/Libs/Boost/Version1_33_1/include/boost/asio/impl/write.ipp:124

124 /usr/trading/Libs/Boost/Version1_33_1/include/boost/asio/impl/write.ipp: No such file or directory.

in /usr/trading/Libs/Boost/Version1_33_1/include/boost/asio/impl/write.ipp

We dont know if we use the boost badly or it is a boost bug. We use the 1.33.1 version and we are upgrading the boost to 1.39.0. This problem is urgent for us and at least it would be good if we knew if the problem is in boost or in our program. Thank you for any information!

Attachments (1)

core.txt (3.9 KB ) - added by elod.biro@… 13 years ago.
crash core stack

Download all attachments as: .zip

Change History (4)

by elod.biro@…, 13 years ago

Attachment: core.txt added

crash core stack

comment:1 by Steven Watanabe, 13 years ago

A few questions:

  • Is this after trying to upgrade to 1.39 or is the program that crashes strictly using 1.33.1?
  • What version of Asio are you using with 1.33.1?
  • What happened to boost/asio/impl/write.ipp?

comment:2 by anonymous, 13 years ago

We use version 1.33.1.

We analysed the problem and now it seems that the problem is at our side. At async_write method (see below) we give the Ccdt_TcpHandler::handleWrite as Callback method. We are not absolutely sure, but the Ccdt_TcpHandler object is deleted before the boost uses Ccdt_TcpHandler::handleWrite as Callback method.

If it is true, then we do not understand that in this case the crash has to happen in Ccdt_TcpHandler::handleWrite method, but according the core file the crash is in boost.

Now we try to avoid the Ccdt_TcpHandler object deleting before Callback.

boost::asio::async_write

( *TcpSocket, boost::asio::buffer

( pMsg->data(), pMsg->length() ),

boost::bind

( &Ccdt_TcpHandler::handleWrite, this, ID, pMsg->id(), pMsg->command(), pMsg->info(), pMsg, boost::asio::placeholders::error )

);

comment:3 by chris_kohlhoff, 13 years ago

Resolution: invalid
Status: newclosed

Closing as OP said that problem was on their side.

Note: See TracTickets for help on using tickets.