Need help debgging thread failure

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5989
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Need help debgging thread failure

Post by ONEEYEMAN »

Hi,,
I need some help debugging the thread failure.

This is what I'm getting inside MSVC debug window:

Code: Select all

The thread 0x2fc4 has exited with code 0 (0x0).
'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\dialogs.dll'
Starting MainFrame::OnClose


Deleting the thread...


The thread 0x16b0 has exited with code 0 (0x0).
Starting thread destructor...


Thread deleted


Looping for thread deletionn


Thread destroyed. Deleting application....


'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\mysql_dll.dll'
'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\libmysql.dll'
'docview.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ws2_32.dll'
'docview.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\nsi.dll'
'docview.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\secur32.dll'
'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\postgres_dll.dll'
'docview.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\wsock32.dll'
'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\odbc_dll.dll'
'docview.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\odbc32.dll'
'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\sqlite.dll'
'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\dbloader.dll'
'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\wxmsw316ud_stc_vc_custom.dll'
'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\propertieshandlers.dll'
'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\propertypages.dll'
'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\fieldswindow.dll'
'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\shapeframework.dll'
'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\wxbase316ud_xml_vc_custom.dll'
'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\dbwindow.dll'
No memory leaks detected.WARNING: Visual Leak Detector: Some threads appear to have not terminated normally.
  This could cause inaccurate leak detection results, including false positives.
Visual Leak Detector is now exiting.
'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\vld_x86.dll'
'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\dbghelp.dll'
'docview.exe' (Win32): Unloaded 'C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbhandler\vc_mswuddll\tabledataedit.dll'
c:\wxwidgets\src\msw\app.cpp(746): 'UnregisterClass(wxMDIFrame)' failed with error 0x00000583 (Class does not exist.).
c:\wxwidgets\src\msw\app.cpp(753): 'UnregisterClass(wxMDIFrameNR)' failed with error 0x00000583 (Class does not exist.).
c:\wxwidgets\src\msw\display.cpp(539): 'UnregisterClass(wxDisplayHiddenWindow)' failed with error 0x00000583 (Class does not exist.).
The thread 0x2b84 has exited with code 0 (0x0).
Detected memory leaks!
Dumping objects ->
{99683} normal block at 0x187DEFF0, 8 bytes long.
 Data: < o      > D4 6F 86 18 00 00 00 00 
{99672} normal block at 0x187DAFF0, 8 bytes long.
 Data: < o      > B0 6F 86 18 00 00 00 00 
{99671} normal block at 0x18862FF0, 8 bytes long.
 Data: < o      > 8C 6F 86 18 00 00 00 00 
{99669} normal block at 0x18866F80, 124 bytes long.
 Data: <P f          /  > 50 AA 66 0F 00 00 00 00 E9 AF 1D 18 F0 2F 86 18 
{97180} normal block at 0x18048FF0, 8 bytes long.
 Data: <        > D4 0F 05 18 00 00 00 00 
{97169} normal block at 0x18160FF0, 8 bytes long.
 Data: <        > B0 0F 05 18 00 00 00 00 
{97168} normal block at 0x18148FF0, 8 bytes long.
 Data: <        > 8C 0F 05 18 00 00 00 00 
{97166} normal block at 0x18050F80, 124 bytes long.
 Data: <P f      o      > 50 AA 66 0F 00 00 00 00 E9 6F D8 17 F0 8F 14 18 
Object dump complete.
The program '[12816] docview.exe' has exited with code 0 (0x0).
I am closing the application correctly by clicking on big red "X".

And below is the Entry function:

Code: Select all

wxThread::ExitCode NewTableHandler::Entry()
{
    std::vector<std::wstring> errorMsg;
    int res;
    while( !TestDestroy() )
    {
        {
//Do some work
            std::lock_guard<std::mutex> locker( m_db->GetTableVector().my_mutex );
            res = m_db->NewTableCreation( errorMsg );
            if( res )
                Delete();
        }
        Sleep( 5000 );
    }
    return (wxThread::ExitCode) 0;
}
At this point I don't even know who to trust - MSVC that tells I have memory leaks or VLD that says the thread crashed and doesn't say anything about the leaks.

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 17306
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Need help debgging thread failure

Post by doublemax »

So there is no crash, just the leaks and the UnregisterClass errors?

What makes you think the thread is related to this issue? I don't see any direct connection.
(BTW: I'm not sure if it's ok to call Delete() from inside the thread.)
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5989
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Need help debgging thread failure

Post by ONEEYEMAN »

doublemax,
Yes, leakage, some UnregisterClass errors and
WARNING: Visual Leak Detector: Some threads appear to have not terminated normally.
.

But this last one - I don't understand at all.

First it says:
Starting MainFrame::OnClose


Deleting the thread...


The thread 0x16b0 has exited with code 0 (0x0).
Starting thread destructor...


Thread deleted


Looping for thread deletionn


Thread destroyed. Deleting application....
which presumably means that everything is deleted correctly. And then the other message appears.

That's why I think /suspect the problem is with the thread.

And that's why i'm confused who trust - VLD or MSVC.


About the Delete() call - I will look into it.

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 17306
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Need help debgging thread failure

Post by doublemax »

Can you make a test without the thread? Or is it essential for your app to run?
Use the source, Luke!
Post Reply