Yet more temporary debug spew for diagnosing mochitest hang.

This commit is contained in:
Chris Jones 2010-01-26 14:57:16 -06:00
Родитель 179a44cb5b
Коммит f21201bf38
5 изменённых файлов: 129 добавлений и 2 удалений

Просмотреть файл

@ -102,8 +102,21 @@ void Thread::Stop() {
DCHECK_NE(thread_id_, PlatformThread::CurrentId());
// StopSoon may have already been called.
if (message_loop_)
if (message_loop_) {
#ifdef OS_LINUX
printf("TEST-UNEXPECTED-FAIL | process %d | posted quit task to other thread\n", getpid());
#endif
message_loop_->PostTask(FROM_HERE, new ThreadQuitTask());
}
// Wait for the thread to exit. It should already have terminated but make
// sure this assumption is valid.
@ -111,8 +124,29 @@ void Thread::Stop() {
// TODO(darin): Unfortunately, we need to keep message_loop_ around until
// the thread exits. Some consumers are abusing the API. Make them stop.
//
#ifdef OS_LINUX
printf("TEST-UNEXPECTED-FAIL | process %d | joining other thread\n", getpid());
#endif
PlatformThread::Join(thread_);
#ifdef OS_LINUX
printf("TEST-UNEXPECTED-FAIL | process %d | other thread joined\n", getpid());
#endif
// The thread can't receive messages anymore.
message_loop_ = NULL;

Просмотреть файл

@ -29,9 +29,28 @@ ChildProcess::~ChildProcess() {
// notice shutdown before the render process begins waiting for them to exit.
shutdown_event_.Signal();
if (child_thread_.get())
if (child_thread_.get()) {
#ifdef OS_LINUX
printf("TEST-UNEXPECTED-FAIL | plugin process %d | IO thread is Stop()ing XPCOM thread\n", getpid());
#endif
child_thread_->Stop();
#ifdef OS_LINUX
printf("TEST-UNEXPECTED-FAIL | plugin process %d | XPCOM thread has been Stop()d\n", getpid());
#endif
}
child_process_ = NULL;
}

Просмотреть файл

@ -381,6 +381,15 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
return false;
}
} else if (bytes_read == 0) {
printf("TEST-UNEXPECTED-FAIL | process %d | read 0 bytes from pipe, it's closed\n", getpid());
// The pipe has closed...
Close();
return false;
@ -697,7 +706,20 @@ void Channel::ChannelImpl::OnFileCanReadWithoutBlocking(int fd) {
if (!waiting_connect_ && fd == pipe_) {
if (!ProcessIncomingMessages()) {
Close();
printf("TEST-UNEXPECTED-FAIL | process %d | notifying client of channel error (read)\n", getpid());
listener_->OnChannelError();
printf("TEST-UNEXPECTED-FAIL | process %d | client notified(read)\n", getpid());
}
}
@ -715,8 +737,29 @@ void Channel::ChannelImpl::OnFileCanReadWithoutBlocking(int fd) {
// Called by libevent when we can write to the pipe without blocking.
void Channel::ChannelImpl::OnFileCanWriteWithoutBlocking(int fd) {
if (!ProcessOutgoingMessages()) {
printf("TEST-UNEXPECTED-FAIL | process %d | failed to process outgoing messages\n", getpid());
Close();
printf("TEST-UNEXPECTED-FAIL | process %d | notifying client of channel error (write)\n", getpid());
listener_->OnChannelError();
printf("TEST-UNEXPECTED-FAIL | process %d | client notified(write)\n", getpid());
}
}
@ -728,7 +771,21 @@ void Channel::ChannelImpl::Close() {
server_listen_connection_watcher_.StopWatchingFileDescriptor();
if (server_listen_pipe_ != -1) {
printf("TEST-UNEXPECTED-FAIL | process %d | closing pipe\n", getpid());
HANDLE_EINTR(close(server_listen_pipe_));
printf("TEST-UNEXPECTED-FAIL | process %d | pipe closed\n", getpid());
server_listen_pipe_ = -1;
}

Просмотреть файл

@ -73,6 +73,15 @@ AsyncChannel::AsyncChannel(AsyncListener* aListener)
AsyncChannel::~AsyncChannel()
{
MOZ_COUNT_DTOR(AsyncChannel);
#ifdef OS_LINUX
printf("TEST-UNEXPECTED-FAIL | process %d | ~AsyncChannel()\n", getpid());
#endif
Clear();
}

Просмотреть файл

@ -368,6 +368,14 @@ XRE_InitChildProcess(int aArgc,
sIOMessageLoop->Run();
#ifdef OS_LINUX
printf("TEST-UNEXPECTED-FAIL | plugin process %d | broke out of IO event loop\n", getpid());
#endif
sIOMessageLoop = nsnull;
}