OutputDebugString and afxDump hangs in w2k 
Author Message
 OutputDebugString and afxDump hangs in w2k

When I run my application from Visual C++ in windows 2000 it stops
responding after running for a couple of hours.
If I pause the app from visual and checks the threads it seem to hang in the
function OutputDebugString().
When I try to step or run the application after the pause, the de{*filter*}
outputs something like:
potential deadlock, resolving.
But the application is still hanged in the same function.

I have seen the database problem described in
http://www.*-*-*.com/
and the DBMon problem described in
http://www.*-*-*.com/

but I don't believe that it has anything to do with that, and I have
upgraded to MDAC 2.6

Any ideas?

Best regards,

Joakim



Sat, 27 Dec 2003 20:58:20 GMT  
 OutputDebugString and afxDump hangs in w2k
OutputDebugString is used for debugging an application. Unless you have an
attached de{*filter*}, it is hardly likely that this function would cause a
deadlock? You should be able to disable calls to OutputDebugString.
Generally, most libraries (nearly all) do not call this function when
compiled in Release mode (as oppose to Debug mode). Often a system defines a
TRACE macro that does exactly this.

#ifdef _DEBUG
#define TRACE(x) OutputDebugString(x)
#else
#define TRACE(x) x
#endif

It looks to me that you (or a library you are using) are using the afxDump
function. Make certain this is surrounded by #ifdefs to guard out against
use when in Release mode.

#ifdef _DEBUG
afxDump << "Dumping myPerson:\n";
myPerson->Dump( afxDump );
afxDump << "\n";
#endif

--
Randy Charles Morin
Author of Programming Windows Services
http://www.*-*-*.com/

Feel free to contact me by private email or messenger



Quote:
> When I run my application from Visual C++ in windows 2000 it stops
> responding after running for a couple of hours.
> If I pause the app from visual and checks the threads it seem to hang in
the
> function OutputDebugString().
> When I try to step or run the application after the pause, the de{*filter*}
> outputs something like:
> potential deadlock, resolving.
> But the application is still hanged in the same function.

> I have seen the database problem described in
> http://www.*-*-*.com/
> and the DBMon problem described in
> http://www.*-*-*.com/

> but I don't believe that it has anything to do with that, and I have
> upgraded to MDAC 2.6

> Any ideas?

> Best regards,

> Joakim



Sun, 28 Dec 2003 02:19:13 GMT  
 OutputDebugString and afxDump hangs in w2k
Hello Joakim,

It is possible that you have chosen a single thread run time for your multi
thread project and cause the problem. If that is the case, we can correct
it by the following steps:

1.      Choose Project -> Settings.
2.      Select C++ tab and choose 'Code Generation' from the Category.
3.      Choose a multi thread run time library.

Regards,
Woody



Sun, 28 Dec 2003 13:27:04 GMT  
 OutputDebugString and afxDump hangs in w2k
Hello Woody,

Thanks for your suggestion, but it was already multithreaded.
Some of the DLLs where "Debug Multithreaded" and others were "Debug
Multithreaded DLL", do you know the difference?

Regards,

Joakim



Quote:
> Hello Joakim,

> It is possible that you have chosen a single thread run time for your
multi
> thread project and cause the problem. If that is the case, we can correct
> it by the following steps:

> 1. Choose Project -> Settings.
> 2. Select C++ tab and choose 'Code Generation' from the Category.
> 3. Choose a multi thread run time library.

> Regards,
> Woody



Sun, 28 Dec 2003 17:30:45 GMT  
 OutputDebugString and afxDump hangs in w2k
On Tue, 10 Jul 2001 14:58:20 +0200, "Joakim Wallman"

Quote:

>When I run my application from Visual C++ in windows 2000 it stops
>responding after running for a couple of hours.
>If I pause the app from visual and checks the threads it seem to hang in the
>function OutputDebugString().
>When I try to step or run the application after the pause, the de{*filter*}
>outputs something like:
>potential deadlock, resolving.
>But the application is still hanged in the same function.

<snip>

Joakim,

I think you are suffering from the problem described in the Microsoft
Knowledgebase article Q173260:

http://www.*-*-*.com/

I have seen the problem occur when I had MFC "TRACE" statements at the
end of thread functions.   Under NT 4.0, everything would run fine, but
under the de{*filter*} the program would deadlock under Win2K.  When not
running under the de{*filter*} the program would execute just fine.

Hope this helps.
Jon



Sun, 28 Dec 2003 20:58:44 GMT  
 OutputDebugString and afxDump hangs in w2k
I think that "Debug mutithreaded DLL" uses functions in a DLL, while the non
DLL version statically links the functions in your executable.
To avoid problems, you should use the same settings for all. Otherwise, you
run the risk of, for instance, using one function to allocated memory and a
non-compatible one (from another DLL) to de-allocate memory.

Salim.


Quote:
> Hello Woody,

> Thanks for your suggestion, but it was already multithreaded.
> Some of the DLLs where "Debug Multithreaded" and others were "Debug
> Multithreaded DLL", do you know the difference?

> Regards,

> Joakim



> > Hello Joakim,

> > It is possible that you have chosen a single thread run time for your
> multi
> > thread project and cause the problem. If that is the case, we can
correct
> > it by the following steps:

> > 1. Choose Project -> Settings.
> > 2. Select C++ tab and choose 'Code Generation' from the Category.
> > 3. Choose a multi thread run time library.

> > Regards,
> > Woody



Tue, 30 Dec 2003 03:43:23 GMT  
 OutputDebugString and afxDump hangs in w2k
Please check the following information:

Multithreaded DLL:

Defines _MT and _DLL so that both multithread- and DLL-specific versions of
the run-time routines are selected from the standard .H files. This option
also causes the compiler to place the library name MSVCRT.LIB into the .OBJ
file.
Applications compiled with this option are statically linked to MSVCRT.LIB.
This library provides a layer of code that allows the linker to resolve
external references. The actual working code is contained in MSVCRT.DLL,
which must be available at run time to applications linked with MSVCRT.LIB.

Debug Multithreaded DLL:

Defines _DEBUG, _MT, and _DLL so that debug multithread- and DLL-specific
versions of the run-time routines are selected from the standard .H files.
It also causes the compiler to place the library name MSVCRTD.LIB into the
.OBJ file.

Regards,
Woody



Sat, 03 Jan 2004 00:38:50 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. OutputDebugString and afxDump hangs in w2k

2. OutputDebugString doesn't work in W2K dllhosts

3. CFileDialog::DoModal hangs on W2K, works fine on WinNT

4. W2k multilanguage platform CD vs localized versions of W2k

5. debug diagnostics and afxdump

6. afxDump loss of output VS6

7. afxDump.HexDump

8. afxDump loss of output VS6

9. Question about afxDump

10. Debug Diagnostics with afxDump

11. old question: re-routing afxDump to a new destination

12. afxDump.HexDump

 

 
Powered by phpBB® Forum Software