[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

event handle leak in TortoiseSVN.dll

From: Joost-Jan van Klaveren <info_at_elwave.com>
Date: Thu, 25 Nov 2010 14:57:55 +0100

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<STYLE type=text/css> P, UL, OL, DL, DIR, MENU, PRE { margin: 0 auto;}</STYLE>

<META name=GENERATOR content="MSHTML 8.00.6001.18702"></HEAD>
<BODY leftMargin=1 rightMargin=1 topMargin=1>
<P><FONT size=2 face=Tahoma>There's a gradual increase in Handles (Windows Task Manager) for explorer.exe noticable, related to how frequent a working copy is browsed/accessed through Windows Explorer. Over time this runs well into thousands (some 33000, a limit seems to get reached).<BR></FONT></P>
<P><FONT size=2 face=Tahoma>I've tracked these handles down to being unnamed kernel event objects using ProcessExplorer(SysInternals) and NTObjects (Russell Osterlund, www.smidgeonsoft.com).</FONT></P>
<P><FONT size=2 face=Tahoma></FONT>&nbsp;</P>
<P><FONT size=2 face=Tahoma>Further debugging revealed the objects getting created at line 117 of src\TortoiseShell\RemoteCacheLink.cpp (</FONT><FONT size=2 face=Tahoma>http://code.google.com/p/tortoisesvn/source/browse/trunk/src/TortoiseShell/RemoteCacheLink.cpp?r=20529)</P></FONT>
<P><FONT size=2 face=Tahoma>m_hEvent gets reassigned without&nbsp;first checking for NULL or INVALID_HANDLE_VALUE.<BR></FONT></P>
<P><FONT size=2 face=Tahoma>I thought of two solutions, either closing the previous handle or not reassigning when already assigned a proper value. Not knowing the exact impact of closing a&nbsp;handle that may already be in use I tried the latter fix (why else make m_hEvent a member with only local use in <SPAN class=typ><FONT color=#660066>CRemoteCacheLink</FONT></SPAN><SPAN class=pun><FONT color=#666600>::</FONT></SPAN><FONT color=#660066><SPAN class=typ>GetStatusFromRemoteCache? seems also more in line with how m_hPipe is created/destroyed). This at least keeps the number of system handles down but not knowing the full impact (specifically, m_hEvent 'handed' to overlapped IO and seeing as this is supposed to handle exceptional cases like crashes) I hesitate to submit this as solution.</SPAN></FONT></FONT></P>
<P><FONT size=2 face=Tahoma><FONT color=#660066><SPAN class=typ></SPAN></FONT></FONT>&nbsp;</P>
<P><FONT size=2 face=Tahoma>Kind regards,<BR></FONT></P>
<P><FONT size=2 face=Tahoma></FONT>&nbsp;</P>
<P><FONT size=2 face=Tahoma>Joost-Jan van Klaveren<BR>--<BR>Prognosis Software Development<BR>Phone: +31.15.2123543&nbsp;&nbsp;&nbsp;&nbsp;Fax: +31.15.2132558<BR>email: </FONT><FONT size=2 face=Tahoma><A href="mailto:info@elwave.com">info@elwave.com</A></FONT><BR><FONT size=2 face=Tahoma>internet: </FONT><FONT size=2 face=Tahoma>http://www.elwave.com</FONT></P>


To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2010-11-25 17:01:15 CET

This is an archived mail posted to the TortoiseSVN Users mailing list.