Boost logo

Boost Users :

From: Farberov, Inga (ifarberov_at_[hidden])
Date: 2007-07-05 12:15:35


On a closer inspection of the stacktrace it looks like some of the
header files are picked up from the /usr/include directory, instead of
my local install of boost.
When I compile, I explicitly provide the right include path to the
compiler.
I have my local installation of boost in LD_LIBRARY_PATH.

Should I be doing something at runtime for includes as well?

Thanx in advance for all the help,
Inga

-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Peter Dimov
Sent: Thursday, July 05, 2007 9:53 AM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] [Boost-user]multithreaded app hangs in
boostlibraries

Farberov, Inga wrote:
> Hello,
>
> I have written a static library that uses boost program_options,
> threads, date-time and serialization libraries. There is also an
> extensive use of shared_ptr.
>
> I am working on a multithreaded application, so when I link my library
> into the executable, I use multithreaded versions of the boost
> libraries. When I compile my library and application that links to
> it, I use -pthread flag in attempt to make it multi-threaded.
>
> Everything compiles and links without a problem, however when I try to
> run the application, it hangs. I have tried to bedug it and when I
> suspend a hanging thread it gives me following stack trace:

...

> 9 pthread_mutex_lock() 0x0042097e
>
> 8 scoped_lock() /usr/include/boost/detail/lwm_pthreads.hpp:72
> 0x080598eb
>
> 7 boost::detail::sp_counted_base::add_ref_copy()
> /usr/include/boost/detail/shared_count.hpp:122 0x0805b679
>
> 6 shared_count()
> /usr/lib/boost/include/boost-1_34/boost/detail/shared_count.hpp:216
> 0x0805b65b

This stack trace makes no sense to me. I understand the shared_count:216

portion; it's the line:

        if( pi_ != 0 ) pi_->add_ref_copy();

But the next level, add_ref_copy is shown to be at shared_count.hpp:122,
and
there's no add_ref_copy there. shared_count:122 is the line

        pi_ = new sp_counted_impl_pd<P, D>(p, d);

in the no-exception branch of shared_count( p, d ).

Next down the stack we have scoped_lock at lwm_pthreads.hpp:72; this is
even
more baffling. add_ref_copy doesn't call into lwm_pthreads; it would
typically call into sp_counted_base_gcc_*.hpp if you CPU is x86, PPC or
IA64, or sp_counted_base_pt if it isn't.

Are you sure that you aren't using 1.34 headers and older libraries?

Have you used -DBOOST_SP_USE_QUICK_ALLOCATOR by any chance? Can you try
placing a

    static boost::shared_ptr<int> p( new int );

variable before your Settings variable? Can you try a debug version of
boost::program_options with inlining off, in a hope that this will
produce a
more reliable stack trace?

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


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