Re: Need Help Debugging

Tech-Archive recommends: Fix windows errors by optimizing your registry



On Sep 25, 8:42 am, "Waleri Todorov" <this...@xxxxxxxxxxxxxxxx> wrote:
Dr. Watson can create a crash minidump, that can be used for postmortem debuggin. It will take you to exact location of the crash. With debug build of your code, you will be positioned to the crash location, with debug info loaded, etc...



"Ben" <benm5...@xxxxxxxxx> wrote in messagenews:1190649816.660022.162510@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a non-managed c++ service that has a crash periodically.

I analyze the DrWatson dump and every time it seems to point to a
ntdll!RtlInitializeCriticalSectionAndSpinCount. I do use
CRITICAL_SECTIONS often throughout the code to manage access to the
variables, since it's a multi-threaded app.

Is there a certain rule of thumb when using Critical Sections to avoid
this ? I saw in MSDN they say to call
InitializeCriticalSectionAndSpinCount instead of just
InitializeCriticalSection in order to avoid memory resource exceptions
on pre-windows-XP systems... but our clients are XP, so I think i'm ok
with using InitializeCriticalSection. Maybe there's something more
recommended to use ?

In my searches, i'm seen some references to stack overflows... i'm not
too familiar with how to avoid it ? can someone offer some
guidance ? I know we use some string variables that can hold a few MB
of xml data... usually they are declared as an STL "string" and passed
as references. Do I need to use 'new' to allocate these large vars ?
does that avoid using the stack ?!?

Thanks for any tips!
ben- Hide quoted text -

- Show quoted text -

I do use DrWatson and set to generate a full dump with symbols. I'm
running 'release' code on my 90 user pilot group since the debug
version has a 30-40% cpu spike every 10 seconds when we enumerate
system procs. But I do have a PDB file generated and all the source
code for each version.

Had about 5 crashes this month all from different PCs, and in all of
them, when I looked at the call stack, it seems to have started with a
call to addToLog (a custom func we have to write to the eventviewer)
in order to log some exception that happened in a try{}catch(...){}
block. The first line of that function is MyEnterCriticalSection,
which is our custom CRITICAL_SECTION class. That's the last line in
my code that call stack leads me to... and the next functions i see in
the stack are usually EnterCriticalSection or
IntializeCriticalSection... but double-clicking on them doesn't lead
me inside my custom MyEnterCriticalSection function... anyone know
why ? I did a full re-build one time, and still didn't help...

btw, the MyEnterCriticalSection is part of a custom class I built to
help track CRITICAL_SECTION usage. So in my code, when i want to
protect a section, I call
MyEnterCriticalSection("NameOfCriticalSection",
"NameOfFunctionThatIsRequesting") -- then my custom function, looks up
if "NameOfSection" appears in the <map> object it uses to store the
CRITICAL_SECTION pointers. If it does, it calls EnterCriticalSection
on it, if it doesn't, it creates a new CRITICAL_SECTION pointer and
adds to the <map> as "NameOfSection", then initializes & enters it.
Every time it messes with the <map> it protects it with
EnterCriticalSection. The beautiful thing, is I can get a report of
every critical_section and see which function 'owns' it and at what
time it aquired it and also see which functions are requesting it
currently... it helped me debug deadlocks in minutes.

.



Relevant Pages

  • Re: Need Help Debugging
    ... you should use straight and plain ADPlus.VBS from the debugger package. ... debug info loaded, etc... ... does that avoid using the stack ?!? ... which is our custom CRITICAL_SECTION class. ...
    (microsoft.public.win32.programmer.kernel)
  • RE: nikto, n-stealth can crash the web-server?
    ... nikto can crash the web-server and why. ... on custom web servers, ... TCP/IP stack: this is mostly old news, ...
    (Pen-Test)
  • Re: Weird behavior, Program bombs out unless Application.DoEvents() or GC.Collect is called.
    ... "John Wood" wrote in message ... > memory on the stack... ... >> from items' using both an ole db dataadapter and my custom db provider, ... >> application to exit and no exception is thrown either. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: parallel computation
    ... I have Pentium D processor and i want to lern how to program second core ... if doing a custom OS, or in DOS, ... ... things as well, like updating the kernel timer, ...). ... push all the registers and other state to the stack; ...
    (comp.lang.asm.x86)