Re: [Boost-bugs] [Boost C++ Libraries] #4854: boost ptr_list serious problem

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4854: boost ptr_list serious problem
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-11-27 15:59:48


#4854: boost ptr_list serious problem
-------------------------------------+--------------------------------------
  Reporter: davidmahorse@… | Owner:
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: None
   Version: Boost 1.44.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------------+--------------------------------------

Comment (by davidmahorse@…):

 struct SeppContext
 {
 .....
   mutex lockForSingleContext;//mutex is a stand version of boost.
 .....
 }

 class sepp
 {
 ....
 //list<SeppContext*> freeContextList; //this stl list works fine
 ptr_list<SeppContext> freeContextList;//this doesn't work ,it cannot
 //crossthread such as epoll linux kernel
 }

 I was trying to test my codes to handle exception:
 so I deliberately throw an exception in one function invoked by epoll
 threads which I defined. This exception is created by this sentence
 like that:
 ...
 scoped_array<char> pa(new char[0x7fffffff]);
 ....
 then I just didn't know there is a problem with ptr_list of boost. I just
 get strange exception of "boost lock" captured by my threads.
 At this time ,this point of "SeppContext" has entered in linux kernel of
 epoll and comes out. I traced where this exception comes from, then I find
 :
 ....
 pContext = freeContextList.back();
 freeContextList.pop_back();
 pContext->lockForSingleContext.lock();//this sentence throws boost lock
 //exception
 ....
 But I have found this point of pContext is good. The address of pContext
 is not changed by kernel of linux. But I can invoke other variable of this
 pContext. But I cannot invoke the mutex of lockForSingleContext in
 SeppContext. If I invoke then a boost lock exception jumps out.
 I have't use static_cast such things. Because I only have one process,but
 it is mult-threaded.
 And if I don't use ptr_list of boost, I find std list works fine. It
 doesn't throw boost lock exception. So I judge this is not the problem of
 my codes. It is the problem of boost ptr_list.
 I just found another serious problem of ip:tcp:socket. The socket handle
 in it cannot cross-thread. The problem is I cannot delete point of
 ip:tcp:socket to release socket handle. This point of ip:tcp:socket is
 also defined in SeppContext. It is not the problem of my codes. It is the
 problem of ASIO of boost.Trust me. I don't use ASIO now. I just use BSD
 socket raw functions. It works fine.
 All my environment is multi-threads and epoll things. Because I am doing
 basic network programming.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4854#comment:4>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC