CodeLite hangs on OSX when I hit the "stop debugger" button :
#0 0x96887066 in __semwait_signal ()
#1 0x96886d22 in _pthread_cond_wait ()
#2 0x968889b8 in pthread_cond_wait$UNIX2003 ()
#3 0x939e4a3a in TSWaitOnCondition ()
#4 0x939d038d in TSWaitOnConditionTimedRelative ()
#5 0x939cbd67 in MPWaitOnQueue ()
#6 0x00abe582 in wxThreadInternal::Wait ()
#7 0x00abe682 in wxThread::Delete ()
#8 0x006af236 in ProcessReaderThread::Stop ()
#9 0x006de00f in UnixProcessImpl::Cleanup ()
#10 0x006de0a5 in UnixProcessImpl::~UnixProcessImpl ()
#11 0x179a8634 in DbgGdb::Stop ()
#12 0x0019d9f1 in Manager::DbgStop ()
#13 0x00ac6903 in wxEvtHandler::ProcessEventIfMatches ()
#14 0x00ac6a7f in wxEventHashTable::HandleEvent ()
#15 0x00ac732f in wxEvtHandler::ProcessEvent ()
#16 0x00c116c2 in wxWindowBase::TryParent ()
#17 0x00ac72dc in wxEvtHandler::ProcessEvent ()
#18 0x00ac72cc in wxEvtHandler::ProcessEvent ()
#19 0x00c116c2 in wxWindowBase::TryParent ()
#20 0x00ac72dc in wxEvtHandler::ProcessEvent ()
#21 0x00d69b7f in wxAuiToolBar::OnLeftUp ()
#22 0x00ac6903 in wxEvtHandler::ProcessEventIfMatches ()
#23 0x00ac6a7f in wxEventHashTable::HandleEvent ()
#24 0x00ac732f in wxEvtHandler::ProcessEvent ()
#25 0x00b56204 in wxMacTopLevelMouseEventHandler ()
#26 0x00b56b76 in wxMacTopLevelEventHandler ()
#27 0x924fbf2f in DispatchEventToHandlers ()
#28 0x924fb1f6 in SendEventToEventTargetInternal ()
#29 0x9251d9bb in SendEventToEventTarget ()
#30 0x9252f4db in ToolboxEventDispatcherHandler ()
#31 0x924fc380 in DispatchEventToHandlers ()
#32 0x924fb1f6 in SendEventToEventTargetInternal ()
#33 0x9251d9bb in SendEventToEventTarget ()
#34 0x00aecad6 in wxApp::MacHandleOneEvent ()
#35 0x00aecbaf in wxApp::MacDoOneEvent ()
#36 0x00b08543 in wxEventLoop::Dispatch ()
#37 0x00bb974f in wxEventLoopManual::Run ()
#38 0x00b902b3 in wxAppBase::MainLoop ()
#39 0x00a7017a in wxEntry ()
#40 0x00019b88 in main ()
This is the latest stable (2.7.0)
I can't test SVN for the reasons we discussed on IRC ( build system issues ) so I don't know if this still happens in SVN
==== List of threads ====
17 0x968b9f56 in __wait4 ()
15 0x96878086 in select$DARWIN_EXTSN ()
14 0x96878086 in select$DARWIN_EXTSN ()
12 0x9685920e in mach_wait_until ()
11 0x9685920e in mach_wait_until ()
10 0x9685920e in mach_wait_until ()
9 0x9685920e in mach_wait_until ()
8 0x9685920e in mach_wait_until ()
7 0x9685920e in mach_wait_until ()
6 0x9685920e in mach_wait_until ()
5 0x9685920e in mach_wait_until ()
4 0x9685920e in mach_wait_until ()
2 "com.apple.libdispatch-manager" 0x9687f942 in kevent ()
* 1 "com.apple.main-thread" 0x96887066 in __semwait_signal ()
==== Thread 1 ====
#0 0x96887066 in __semwait_signal ()
#1 0x96886d22 in _pthread_cond_wait ()
#2 0x968889b8 in pthread_cond_wait$UNIX2003 ()
#3 0x939e4a3a in TSWaitOnCondition ()
#4 0x939d038d in TSWaitOnConditionTimedRelative ()
#5 0x939cbd67 in MPWaitOnQueue ()
#6 0x014a6802 in wxThreadInternal::Wait ()
#7 0x014a710b in wxThread::Delete ()
#8 0x00771256 in ProcessReaderThread::Stop ()
#9 0x007a32af in UnixProcessImpl::Cleanup ()
#10 0x007a3348 in UnixProcessImpl::~UnixProcessImpl ()
#11 0x17caabb7 in DbgGdb::Stop ()
#12 0x001bfcfc in Manager::DbgStop ()
#13 0x014aef53 in wxEvtHandler::ProcessEventIfMatches ()
#14 0x014af5d1 in wxEventHashTable::HandleEvent ()
#15 0x014af97f in wxEvtHandler::ProcessEvent ()
#16 0x010a3e38 in wxWindowBase::TryParent ()
#17 0x014af929 in wxEvtHandler::ProcessEvent ()
#18 0x014af919 in wxEvtHandler::ProcessEvent ()
#19 0x010a3e38 in wxWindowBase::TryParent ()
#20 0x014af929 in wxEvtHandler::ProcessEvent ()
#21 0x00c8ba0f in wxAuiToolBar::OnLeftUp ()
#22 0x014aef53 in wxEvtHandler::ProcessEventIfMatches ()
#23 0x014af5d1 in wxEventHashTable::HandleEvent ()
#24 0x014af97f in wxEvtHandler::ProcessEvent ()
#25 0x00ff0ece in wxMacTopLevelMouseEventHandler ()
#26 0x00ff13b6 in wxMacTopLevelEventHandler ()
#27 0x924fbf2f in DispatchEventToHandlers ()
#28 0x924fb1f6 in SendEventToEventTargetInternal ()
#29 0x9251d9bb in SendEventToEventTarget ()
#30 0x9252f4db in ToolboxEventDispatcherHandler ()
#31 0x924fc380 in DispatchEventToHandlers ()
#32 0x924fb1f6 in SendEventToEventTargetInternal ()
#33 0x9251d9bb in SendEventToEventTarget ()
#34 0x00f8bab6 in wxApp::MacHandleOneEvent ()
#35 0x00f8c2eb in wxApp::MacDoOneEvent ()
#36 0x00fa5c93 in wxEventLoop::Dispatch ()
#37 0x0104d378 in wxEventLoopManual::Run ()
#38 0x010264b3 in wxAppBase::MainLoop ()
#39 0x0145c060 in wxEntry ()
#40 0x00039d78 in main ()
==== Thread 14 ====
#0 0x96878086 in select$DARWIN_EXTSN ()
#1 0x007a35c0 in UnixProcessImpl::Read ()
#2 0x00771378 in ProcessReaderThread::Entry ()
#3 0x014a7610 in wxThreadInternal::MacThreadStart ()
#4 0x939afdee in PrivateMPEntryPoint ()
#5 0x9688681d in _pthread_start ()
#6 0x968866a2 in thread_start ()
==== Thread 15 =====
#0 0x96878086 in select$DARWIN_EXTSN ()
#1 0x97a8080d in __CFSocketManager ()
#2 0x9688681d in _pthread_start ()
#3 0x968866a2 in thread_start ()
==== Thread 17 ====
#0 0x968b9f56 in __wait4 ()
#1 0x968b9f49 in waitpid$UNIX2003 ()
#2 0x007a3717 in UnixProcessImpl::Read ()
#3 0x00771378 in ProcessReaderThread::Entry ()
#4 0x014a7610 in wxThreadInternal::MacThreadStart ()
#5 0x939afdee in PrivateMPEntryPoint ()
#6 0x9688681d in _pthread_start ()
#7 0x968866a2 in thread_start ()
In thread 14, I'm constantly in UnixProcessImpl::Read (); so either UnixProcessImpl::Read () does not return, either it's called continuously instead of stopping like was requested.
Thread 17 seems very interesting. It's blocking on waitpid, but in this case the process in question is already terminated. I'm not sure how waitpid would behave in this case; here it seems that it hangs.
If the process has terminated, they should not have been waiting indefinitely under waitpid..
however, I changed all calls to waitpid in UnixProcessImpl / ProcessReaderThread to pass the WNOHANG option this should avoid the hanging
I changed the way codelite performs clean up for terminated processes.
It is now done in a signal handler for SIGCHLD in addition, I added the WNOHANG option to the waitpid() system call to prevent it from blocking.
I tested it under Ubuntu 10.10 and it seems to be functioning properly (i.e. no 'defunct' processes leftovers, no hangs etc)
the change looks good
It's hard to reproduce the situations that caused the bug initially, since I could reproduce it mostly when "sleep" tty detection failed - now with the built-in console it's much harder to reproduce the bug. So I'll consider it fixed, and we can reopen this issue if I ever see it again