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

Re: Strange crashes

From: Thomas Hruska <thruska_at_cubiclesoft.com>
Date: 2006-04-11 00:15:06 CEST

Stefan Küng wrote:
> Hi,
>
> As you know, I get crashreports sent in from users where TSVN crashes.
> Now I've already received several of those for every version we
> released, but I just can't think of a reason why a program can crash there:
>
> if (cachedDir)
> return m_mostRecentStatus = cachedDir->GetStatusForMember(...);
>
> The crash happens on the second line, because 'cachedDir' is NULL!
> Now, how can it crash there? The if() statement above should make sure
> that 'cachedDir' isn't NULL when the second line is executed.
> Really, I'm lost here.
> Does anyone of you have an idea why a program could crash that way? Did
> I miss something?
>
> Stefan

I realize this is probably a seemingly benign change, but you may get
quite a bit more information if you do:

-----------------------------------
     CTSVNPath TempPath;
     CCachedDirectory *cachedDir;

     TempPath = path.GetContainingDirectory();
     cachedDir = GetDirectoryCacheEntry(TempPath);

     if (cachedDir != NULL)
     {
       m_mostRecentStatus = cachedDir->GetStatusForMember(path, bRecursive);
       return m_mostRecentStatus;
     }
   ...
   ATLTRACE("Ignored no good path %ws\n", path.GetWinPath());
   m_mostRecentStatus = CStatusCacheEntry()
   return m_mostRecentStatus;
-----------------------------------

I've had a good deal of experience with debuggers. They like lots of
freedom to handle issues like crash bugs. The above code will catch
anything in that specific segment of code worth catching (optimizing
compiler or otherwise). However, I believe the problem is NOT there.

Instead, you should be looking at the implementation of
GetDirectoryCacheEntry() and GetContainingDirectory(). A crash on some
non-relevant bit of code (particularly in an optimized build) indicates
something happened a few lines/functions before and only _NOW_ the
problem is showing up.

Also, I see you rely heavily on the STL. It is possible you have found
a bug in your STL implementation or you aren't protecting it well enough
(e.g. missed a critical section lock).

IMO, every crash bug has a real explanation other than overclocking
being the problem. A lot of crash bugs occur because of poor
application designs.

--
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197
Safe C++ Design Principles (First Edition)
Learn how to write memory leak-free, secure,
portable, and user-friendly software.
Learn more and view a sample chapter:
http://www.CubicleSoft.com/SafeCPPDesign/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Tue Apr 11 00:16:59 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.