Re: [Opalvoip-devel] Memory lake during thread ended on Linux
Brought to you by:
csoutheren,
rjongbloed
From: Yuriy C. <yur...@gm...> - 2008-11-26 17:31:40
|
Thanks Craig for your rapid draft patch of this problem, it is allow me to use my lib in production. I fully agree with you that this patch of the discussion problem will not completely resolve it, because mandatory somebody will put PTRACE in incorrect place and will get the same problem. Maybe it must be Assertion if PTRACE in wrong place? Truly yours, Yuriy. > -----Original Message----- > From: Craig Southeren [mailto:cr...@po...] > Sent: Wednesday, November 26, 2008 2:39 PM > To: Yuriy Cherniavsky > Cc: 'Derek Smithies'; opa...@li... > Subject: Re: [Opalvoip-devel] Memory lake during thread ended on Linux > > Yuriy Cherniavsky wrote: > > Hi Derek > > ..deleted > > > But try to run: "./threadex -d 1 -a -t 5" and you will see appearance > of the > > bug which I describe early. > > > > ..deleted > > I've tracked down the problem. > > The issue is that it is not possible to use PTRACE in the destructor of > an auto-delete thread on Linux. If this is done, the PTRACE detects > that > the active thread is not current and creates a new PExternalThread > which > never gets cleaned up. This causes the code to do strange things, > including running out of handles and crashing. > > There is already a comment in threadex/main.cxx, that says not to use > PTRACE in the destructor, but someone put one in there anyway (svn > blame > says Robert did it) :) > > If I comment out line 349 of tlibthrd.cxx and line 144 of main.cxx, > then > threadex runs for 30 mins on my RedHat FC9 system before I run out of > patience. That's with full logging > > This problem is a side-effect of recent-ish changes to the PTRACE > system > to make it more robust and friendly to non-PTLib threads. The > work-around is to not use PTRACE in the destructor of auto-delete > threads. That's not really a solution - so I'm working on a new one > > I'll post again when I find something. > > Craig > > > > ----------------------------------------------------------------------- > Craig Southeren Post Increment - VoIP Consulting and > Software > cr...@po... > www.postincrement.com.au > > Phone: +61 243654666 ICQ: #86852844 > Fax: +61 243656905 MSN: cra...@ho... > Mobile: +61 417231046 Jabber: cr...@ja... > > "Science is the poetry of reality." Richard Dawkins |