Re: Process exits premature

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"hd" <hd@xxxxxxxxxxx> wrote in message news:eSHPys19JHA.5780@xxxxxxxxxxxxxxxxxxxxxxx
(Since I always get very good insights and ideas in this group, I try again
here. Forgive me if this is off topic. Thanks in advance!)

In an app are there two processes A and B. Both in C#, though B uses bunch
of modules of unmanaged code. A is a Windows service and B standalone
console app. A starts B.

The symptom is:

1. After A starts B, B SOMETIMES exits itself earlier.

Let's say B has main thread waiting for another thread which is a windows
callback function. In this callback function, the code is like:

CallbackFunction()
{
...
Statement 1
Log1
Statement 2
Log2
Statement 3
Log3
Statement 4
Log4
Statement 5 (end of the function)
}

The above statements have some disc access (file saving activities).

Logs indicate that sometimes the whole process B gets disappeared without
all the above statements executed, plus the main thread doesn't finished up
to the end either.

2. No exception, no event viewer log, no dump.

3. The end point within CallbackFunction() changes too, could be Log2, or
Log3, or Log4.

4. It only happens when B is started by A. It will not happen when running B
alone.

Any ideas of how to approach the problem?
Hi,

Usual rules would apply.
You could try attaching debugger to B - I'm not sure how it works with managed code, but in case of un-managed code you could add:

DebugBreak();

- near place where execution starts and recompile. Once B is launched (by A) and DebugBreak() is reached, VS debugger will come up and you'll be able to step through code, inspect variables, etc. If you can reproduce the problem under debugger, everything is fine. If not, you might need to instrument your code: so that it writes strings into your custom logfile (or just use OutputDebugString() to send logging output to debug console, instead of logfile - DebugView.exe can be used to view messages sent to debug console).

Boris

.



Relevant Pages

  • Re: HELP ME-RDI Protocol
    ... > passed back to debugger. ... > create console window" this message is coming during call to ... Since your debugger is a console app, ...
    (comp.arch.embedded)
  • Can I debug a console app byt attaching a debugger to its process ?
    ... I compiled a console app to be debuggable and i verified to have the ... pdb file along with the .exe file. ... allows me to attache the debugger to the cmd.exe process successfully. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: pass commandline parameters
    ... >> I have a app (proj) that is called from the console and it passes ... > Look in the project settings for the debugger section. ...
    (microsoft.public.vc.mfc)
  • Re: CeDialer Sample
    ... breakpoints are not called. ... I am not familiar with the CeDialer Sample, and I use eMbedded VC, but I ... The eVC debugger will only debug on 1 thread. ... line callback function is part of another thread, ...
    (microsoft.public.pocketpc.developer)
  • Re: How to limit the number of instances of an application on a server?
    ... I use the EnumWindows() and a callback function to find the current ... number of instances of my app for any given user (as per Joe ...
    (microsoft.public.vc.mfc)