Re: 0.60 hangs at pthread_mutex_lock

James Lee <[email protected]>
Newsgroups gmane.comp.gnu.aspell.devel
Message-ID <[email protected]>
On 27/04/04, 17:26:07, Kevin Atkinson <[email protected]> wrote regarding Re: 
[aspell-devel] 0.60 hangs at pthread_mutex_lock :

> > > > Both get_cache_data methods in cache_t.hpp call the mutex lock
> > > > a second time without unlocking. The first lock is on entry and
> > > > the second from copy. This happens when the lock of n is the
> > > > same as that of cache. The mutex will not unlock as the thread
> > > > locked it itself, hence the thread thread blocks on the second
> > > > lock.
> >
> > > Could I have a test cast that will trigger the problem?
> >
> > A case. Pan via gtkspell as mentioned above - fails every time.

> So I should Pan so I can find the problem?

Yes, if that what it takes. I had to compile them both too.



> Can I at least have a backtrace?

#0  0xdeedb3e8 in _lwp_sema_wait () from /usr/lib/libc.so.1
#1  0xdef6971d in _park () from /usr/lib/libthread.so.1
#2  0xdef69543 in _swtch () from /usr/lib/libthread.so.1
#3  0xdef6aa9c in _mutex_adaptive_lock () from /usr/lib/libthread.so.1
#4  0xdef6b3e5 in pthread_mutex_lock () from /usr/lib/libthread.so.1
#5  0xdfaa47ac in acommon::Mutex::lock() (this=0xdfb51c60) at 
common/lock.hpp:38
#6  0xdfaa3894 in acommon::Lock::Lock(acommon::Mutex*) (this=0x80452a0, 
l=0xdfb51c60) at common/lock.hpp:60
#7  0xdfa476b9 in acommon::Cacheable::copy() const (this=0x8397118) at 
common/cache.cpp:13
#8  0xdfacba91 in acommon::PosibErr<acommon::Decode*> 
acommon::get_cache_data<acommon::Decode>(acommon::GlobalCache<acommon::Dec
ode>*, acommon::Decode::CacheConfig*, acommon::Decode::CacheKey const&) 
(cache=0xdfb51c60, config=0x838c750, key=@0x80453bc) at 
common/cache-t.hpp:61
#9  0xdfac3614 in acommon::PosibErr<void> 
acommon::setup<acommon::Decode>(acommon::CachePtr<acommon::Decode>&, 
acommon::GlobalCache<acommon::Decode>*, acommon::Decode::CacheConfig*, 
acommon::Decode::CacheKey const&) (res=@0x839c978, cache=0xdfb51c60, 
config=0x838c750, key=@0x80453bc) at common/cache.hpp:71
#10 0xdfa5dcb5 in acommon::Convert::init(acommon::Config const&, 
acommon::ParmString, acommon::ParmString) (this=0x839c978, c=@0x838c750, 
in={str_ = 0x8396ed0 "iso-8859-1", size_ = 4294967295}, out={str_ = 
0x8396f60 "utf-8", size_ = 4294967295}) at common/convert.cpp:924
#11 0xdfa5e726 in acommon::Convert::init_norm_to(acommon::Config const&, 
acommon::ParmString, acommon::ParmString) (this=0x839c978, c=@0x838c750, 
in={str_ = 0x8396ed0 "iso-8859-1", size_ = 4294967295}, out={str_ = 
0x8396f60 "utf-8", size_ = 4294967295}) at common/convert.cpp:973
#12 0xdfa5d12f in acommon::internal_new_convert(acommon::Config const&, 
acommon::ParmString, acommon::ParmString, bool, acommon::Normalize) 
(c=@0x838c750, in={str_ = 0x8396ed0 "iso-8859-1", size_ = 4294967295}, 
out={str_ = 0x8396f60 "utf-8", size_ = 4294967295}, if_needed=true, 
norm=NormTo) at common/convert.cpp:881
#13 0xdfa6d7bf in acommon::new_convert_if_needed(acommon::Config const&, 
acommon::ParmString, acommon::ParmString, acommon::Normalize) 
(c=@0x838c750, in={str_ = 0x8396fa8 "iso-8859-1", size_ = 10}, out={str_ 
= 0xdfafd21c "utf-8", size_ = 4294967295}, n=NormTo) at 
common/convert.hpp:222
#14 0xdfadef3b in acommon::ConvObj::setup(acommon::Config const&, 
acommon::ParmString, acommon::ParmString, acommon::Normalize) 
(this=0x80457e0, c=@0x838c750, from={str_ = 0x8396fa8 "iso-8859-1", size_ 
= 10}, to={str_ = 0xdfafd21c "utf-8", size_ = 4294967295}, norm=NormTo) 
at common/convert.hpp:233
#15 0xdfaf598c in acommon::Conv::setup(acommon::Config const&, 
acommon::ParmString, acommon::ParmString, acommon::Normalize) 
(this=0x80457c0, c=@0x838c750, from={str_ = 0x8396fa8 "iso-8859-1", size_ 
= 10}, to={str_ = 0xdfafd21c "utf-8", size_ = 4294967295}, norm=NormTo) 
at common/convert.hpp:317
#16 0xdfa88f1b in aspeller::Language::set_lang_defaults(acommon::Config&) 
const (this=0x8394680, config=@0x838c750) at 
modules/speller/default/language.cpp:308
#17 0xdfa7329f in 
aspeller::Dictionary::set_check_lang(acommon::ParmString, 
acommon::Config&) (this=0x83925a8, l={str_ = 0x8394638 "\en", size_ = 
4294967295}, config=@0x838c750) at modules/speller/default/data.cpp:98
#18 0xdfa6881f in (anonymous 
namespace)::ReadOnlyDict::load(acommon::ParmString, acommon::Config&, 
aspeller::LocalDictList*, aspeller::SpellerImpl*, aspeller::LocalDictInfo 
const*) (this=0x83925a8, f0={str_ = 0x8390550 
"/opt/csw/lib/asp\ell/\en-only.rws", size_ = 31}, config=@0x838c750) at 
modules/speller/default/readonly_ws.cpp:353
#19 0xdfa754bf in aspeller::add_data_set(acommon::ParmString, 
acommon::Config&, aspeller::LocalDict&, aspeller::LocalDictList*, 
aspeller::SpellerImpl*, aspeller::LocalDictInfo const*, 
acommon::ParmString, unsigned) (fn={str_ = 0x838d9bd "\en-only.rws", 
size_ = 11}, config=@0x838c750, res=@0x8045d50, new_dicts=0x8046390, 
speller=0x838d5d0, local_info=0x8045d50, dir={str_ = 0x838c630 
"/opt/csw/lib/asp\ell", size_ = 19}, allowed=255) at 
modules/speller/default/data.cpp:444
#20 0xdfa76821 in (anonymous 
namespace)::MultiDictImpl::load(acommon::ParmString, acommon::Config&, 
aspeller::LocalDictList*, aspeller::SpellerImpl*, aspeller::LocalDictInfo 
const*) (this=0x838d910, fn={str_ = 0x838c678 
"/opt/csw/lib/asp\ell/\en_GB.multi", size_ = 31}, config=@0x838c750, 
new_dicts=0x8046390, speller=0x838d5d0, li=0x0) at 
modules/speller/default/multi_ws.cpp:65
#21 0xdfa754bf in aspeller::add_data_set(acommon::ParmString, 
acommon::Config&, aspeller::LocalDict&, aspeller::LocalDictList*, 
aspeller::SpellerImpl*, aspeller::LocalDictInfo const*, 
acommon::ParmString, unsigned) (fn={str_ = 0x837f450 
"/opt/csw/lib/asp\ell/\en_GB.multi", size_ = 31}, config=@0x838c750, 
res=@0x8046360, new_dicts=0x8046390, speller=0x838d5d0, local_info=0x0, 
dir={str_ = 0x0, size_ = 4294967295}, allowed=255) at 
modules/speller/default/data.cpp:444
#22 0xdfa7f871 in aspeller::SpellerImpl::setup(acommon::Config*) 
(this=0x838d5d0, c=0x838c750) at modules/speller/default/speller_impl.cpp:435
#23 0xdfaa0374 in acommon::new_speller(acommon::Config*) (c0=0x838bc68) 
at lib/find_speller.cpp:403
#24 0xdfaa0ebf in new_aspell_speller (config=0x838bc68) at 
lib/speller-c.cpp:26
#25 0xdfb73704 in gtkspell_set_language_internal (spell=0x838a4e0, 
lang=0x8047f42 "\en_GB", error=0x0) at gtkspell.c:429
#26 0xdfb7397b in gtkspell_new_attach (view=0x838b310, lang=0x0, 
error=0x0) at gtkspell.c:520
#27 0xdfb73d25 in gtkspell_attach (view=0x838b310) at deprecated.c:34
#28 0x0808caaf in create_body_pane_nolock (mw=0x8380f08) at 
message-window.c:1989
#29 0x0808a5f9 in create_post_info_pane (mw=0x8380f08) at 
message-window.c:1123
#30 0x0808ce41 in message_post_window_create (compose=0x8380f08) at 
message-window.c:2039
#31 0x0808d318 in message_window_new (message=0x0, type=NNTP_POST) at 
message-window.c:2152
#32 0x0808cccb in message_post_window () at message-window.c:2019
#33 0x0806b961 in pan_action_do (action=ACTION_COMPOSE_NEW) at 
action.c:89
#34 0x0808341a in toolbar_cb (button=0x8266a10, user_data=0x0) at 
gui.c:1152
#35 0xdf4c4d87 in g_cclosure_marshal_VOID__VOID () from 
/opt/csw/lib/libgobject-2.0.so.0
#36 0xdf4b0bd1 in g_object_steal_data () from 
/opt/csw/lib/libgobject-2.0.so.0
#37 0xdf4ead4c in ?? () from /opt/csw/lib/libgobject-2.0.so.0
#38 0xdf4a8eac in g_closure_invoke () from 
/opt/csw/lib/libgobject-2.0.so.0
#39 0x08046990 in ?? ()





> > The key to the problem is the lock of the cache is the same as that
> > of n, n being the object return from the cache by find. I can't
> > tell if this is the error or what is intended.
> >
> > An avoidance tactic is to unlock the mutex explicitly, then it can
> > be unlock after the find and before the copy.

> I'm still not exactly sure where the problem is.  A patch to fix the
> problem will be most welcome.

I can see the problem (as described twice above) but I don't know if
it is correct that the lock is shared, hence which problem should be
fixed? The cache or the lock?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.