[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rpm-devel
Subject:    Re: Usage mutexes and embedded interpreters
From:       Jeff Johnson <n3npq () mac ! com>
Date:       2009-04-24 15:13:13
Message-ID: 582B59D7-A412-4C92-BB38-A6FE9A277C58 () mac ! com
[Download RAW message or body]


On Apr 24, 2009, at 10:33 AM, Jeff Johnson wrote:

> There's a class of problems with memory pools
> that are gonna show up as embedded interpreters
> start taking refcnt's on rpm objects.
>
> There's a lock on the interpreter, which can have modules
> which lock native rpm objects. And so the teardown of
> the pools becomes order dependent.
>
> There's two failure modes as currently implemented:
>
> 1) the FIXME message (which is annoying but harmless)
>
> 2) an EINVAL abort while freeing the yarn lock.
>
> Here's what I'm seeing dinking about with a "global"
> (because I'm adding additional classes) rpmjs interpreter.
>
> warning: pool js: FIXME: made 1, count 0
> Note: This is a harmless memory leak discovered while exiting,  
> relax ...
> warning: pool ps: FIXME: made 1, count 0
> Note: This is a harmless memory leak discovered while exiting,  
> relax ...
> --> js 0x8483478 -- 1 rpmioClean at rpmio.c:3169
> ==> rpmjsFini(0x8483478) glob 0x84a3000 cx 0x8487560 rt 0x848af90
> ==> rpmps_dtor(0x8487560,0x84a35e0) ptr 0x84b6db8
> ==> rpmfi_dtor(0x8487560,0x84a3500) ptr (nil)
> ==> rpmds_dtor(0x8487560,0x84a34e0) ptr (nil)
> ==> rpmte_dtor(0x8487560,0x84a34c0) ptr (nil)
> ==> rpmts_dtor(0x8487560,0x84a34a0) ptr (nil)
> ==> rpmps_dtor(0x8487560,0x84a3480) ptr (nil)
> ==> rpmmi_dtor(0x8487560,0x84a3460) ptr (nil)
> ==> rpmhdr_dtor(0x8487560,0x84a3440) ptr (nil)
> yarn: pthread error: Invalid argument(22) -- aborting at yarn.c:265
> lt-tjs: yarn.c:194: _fail: Assertion `0' failed.
> Aborted
>
> I'll sort out something soon. With refcounted memory alloc's its
> largely just getting the refcnts correct.
>

All but one of the problems I'm seeing got fixed by
tearing done the _rpmjsI "global" interpreter in rpmcliFini()
rather than rpmioClean().

There is however one more issue with then snarled up
rpmts, rpmdb, rpmdbMatchIterator interconnections.

This error is from a recursive lock while dereferencing
interlinked objects:

==> rpmfi_dtor(0x81d0560,0x81ec500) ptr (nil)
==> rpmds_dtor(0x81d0560,0x81ec4e0) ptr (nil)
==> rpmte_dtor(0x81d0560,0x81ec4c0) ptr (nil)
==> rpmts_dtor(0x81d0560,0x81ec4a0) ptr (nil)
==> rpmps_dtor(0x81d0560,0x81ec480) ptr (nil)
==> rpmmi_dtor(0x81d0560,0x81ec460) ptr (nil)
==> rpmhdr_dtor(0x81d0560,0x81ec440) ptr (nil)
yarn: pthread error: Device or resource busy(16) -- aborting at yarn.c: 
333
lt-tjs: yarn.c:194: _fail: Assertion `0' failed.
Aborted

The fix is to find the recursion, release and re-acquire the
lock in some rpmfooFini destructor. Note that all the destructors
are called with the object mutex held, causing deadlock (as above)
when recursing.

Likely the rpmdbMatchIterator is where the problem is ...

73 de Jeff
> 73 de Jeff
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> Developer Communication List                        rpm-devel@rpm5.org

______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
Developer Communication List                        rpm-devel@rpm5.org
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic