Visual C++ Developer Center > Visual C++ Forums > Visual C++ General > MFC Application crashes after 24.9 days
Ask a questionAsk a question
 

AnswerMFC Application crashes after 24.9 days

  • Wednesday, November 04, 2009 6:40 AMChristian Dudzik Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello,

    i have a problem concerning a MFC application developed with Visual Studio 2003 .NET.
    After 24.9 days of runtime the whole application crashes.

    Unfortunately, i havent seen a crash on my debug-environment yet and it seemsthat i am not able
    to reproduce the problem at all.

    According to our customer, the problem occurs on different operating systems (winXP, win2000, win2003 server)
    and different computer hardware (1gb ram, 2gb ram etc).

    Any ideas how to reproduce this problem?
    I wrote a small application that maniuplates the current system time
    (24.9 days in ~1 minute) but im not able to crash the application

    thanks!

Answers

  • Wednesday, November 04, 2009 10:37 AMWayneAKing Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Can they not kill the application from the Task Manager?

    From looking at the Task Manager, is the application dead (0% CPU use)
    or in a tight loop (99%)?

    What does the memory used/available look like when the app hangs?

    It's unlikely that faking an elapsed time interval will be of much help.
    You're more than likely experiencing a problem which develops (gradually)
    as the program runs. e.g. - memory leaks, other resource leaks, corruption
    of the heap, overwriting critical areas of the program's memory, etc.

    Loss of program control can also occur when a numeric overflow occurs.
    e.g. - A numeric variable being used to control program logic flow
    exceeds its capacity causing an unexpected comparison result.

    You have some debugging to do. Use all the tools at your disposal.

    - Wayne

All Replies

  • Wednesday, November 04, 2009 6:56 AMWayneAKing Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    The terms "crash", "crashes", "crashed", "crashing" etc. are ambiguous,
    non-technical, and simply mean "something bad happened". They offer no
    clues as to the nature of the malfunction. You are unlikely to get much
    useful advice with such a lack of specificity.

    Obtain from your users a more meaningful description of what happens.
    Does the program hang? Does the OS? Does it display an error message?
    If so, what *exactly* does it say? (No paraphrasing!)

    - Wayne
  • Wednesday, November 04, 2009 7:42 AMChristian Dudzik Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    sorry of course you are right.

    some users reported that only the program hangs, and they were able to restart the computer manually
    by clicking START->RESTART, others reported that the whole OS hangs and they could only do a hard reset.
    An error message is not displayed.
  • Wednesday, November 04, 2009 10:37 AMWayneAKing Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Can they not kill the application from the Task Manager?

    From looking at the Task Manager, is the application dead (0% CPU use)
    or in a tight loop (99%)?

    What does the memory used/available look like when the app hangs?

    It's unlikely that faking an elapsed time interval will be of much help.
    You're more than likely experiencing a problem which develops (gradually)
    as the program runs. e.g. - memory leaks, other resource leaks, corruption
    of the heap, overwriting critical areas of the program's memory, etc.

    Loss of program control can also occur when a numeric overflow occurs.
    e.g. - A numeric variable being used to control program logic flow
    exceeds its capacity causing an unexpected comparison result.

    You have some debugging to do. Use all the tools at your disposal.

    - Wayne
  • Wednesday, November 04, 2009 12:40 PM.Sreedhar Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    As  Wayne said, its because of memory leaks or head corruptions, gdi leaks etc.

    As you said its is difficult to reporduce the situation by waiting for 24 days, And you may not get the error by changing the system time (I think it is not related with the time)

    so do proper code review to check memory leaks and gdi leaks.

    add asserts to your code and use some tools like debug view and observe the logs




    Knowledge is like light; It spreads only when you have clear and transparent mind. - Sreedhar Dv