diff options
author | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-07 01:25:14 +0000 |
---|---|---|
committer | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-07 01:25:14 +0000 |
commit | aebaf168f19c51ef47eb21cbeb359612e0a4300e (patch) | |
tree | 90a6660db209612ae077b91c84f148f5d65cf69c /content/common/np_channel_base.cc | |
parent | 3ed847a6f774ee7aafdf24ff158f968919163f1a (diff) | |
download | chromium_src-aebaf168f19c51ef47eb21cbeb359612e0a4300e.zip chromium_src-aebaf168f19c51ef47eb21cbeb359612e0a4300e.tar.gz chromium_src-aebaf168f19c51ef47eb21cbeb359612e0a4300e.tar.bz2 |
[Mac] Log stack trace for OnChannelError() in bug 97285.
The hypothesis in comment #67 is that OnChannelError() is being called
to invalidate a channel, and the invalid channel is later being vended
from the cache. This will verify if OnChannelError() was previously
called on the channel, and also provide a backtrace to determine what
the context was.
BUG=97285
TEST=crash server
Review URL: https://chromiumcodereview.appspot.com/10544038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140921 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/np_channel_base.cc')
-rw-r--r-- | content/common/np_channel_base.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/content/common/np_channel_base.cc b/content/common/np_channel_base.cc index d9b2e42..c310ffd 100644 --- a/content/common/np_channel_base.cc +++ b/content/common/np_channel_base.cc @@ -16,6 +16,25 @@ #include "ipc/ipc_channel_posix.h" #endif +// TODO(shess): Debugging for http://crbug.com/97285 +// +// The hypothesis at #67 is that OnChannelError() is being called, but +// the channel is not being removed from the cache. Add code to +// record the stack trace in OnChannelError(), and push it to breakpad +// when the error case happens. +#if defined(OS_MACOSX) +#include "base/debug/stack_trace.h" +#include "base/mac/crash_logging.h" +#include "base/sys_string_conversions.h" + +namespace { + +// Breakpad key for the OnChannelError() backtrace. +const char* kErrorTraceKey = "channel_error_bt"; + +} // namespace +#endif + typedef base::hash_map<std::string, scoped_refptr<NPChannelBase> > ChannelMap; static base::LazyInstance<ChannelMap>::Leaky g_channels = LAZY_INSTANCE_INITIALIZER; @@ -37,6 +56,18 @@ NPChannelBase* NPChannelBase::GetChannel( channel = iter->second; #if defined(OS_POSIX) // Investigation for crbug.com/97285. +#if defined(OS_MACOSX) + // If error_trace_ is set, that implies !channel_valid(). Log the + // trace under a breakpad key for debugging. If there is no + // error_trace_, that implies that the Init() below is failing + // somehow. + if (channel->error_trace_.get()) { + size_t count = 0; + const void* const* addresses = channel->error_trace_->Addresses(&count); + base::mac::SetCrashKeyFromAddresses( + base::SysUTF8ToNSString(kErrorTraceKey), addresses, count); + } +#endif CHECK(channel->channel_valid() || channel_handle.socket.fd != -1); #endif } @@ -256,6 +287,10 @@ bool NPChannelBase::OnControlMessageReceived(const IPC::Message& msg) { } void NPChannelBase::OnChannelError() { +#if defined(OS_MACOSX) + error_trace_.reset(new base::debug::StackTrace()); +#endif + channel_valid_ = false; } |