Commit 4f98a890 authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

Record service interface names in crash key

Services ported to the newer service model have not been logging their
service name in the "service-name" crash key used by other services.
That can make utility process crashes difficult to pinpoint on a
specific service.

This ensures that all services stash their name in the "service-name"
crash key.

Note that unlike in the old model, there is no concept of "service name"
beyond the name of a service's primordial Mojo interface; so that's
what's logged in these cases.

Bug: 1024560
Fixed: 1024601
Change-Id: I98f8887925e2e0012b6f281db5df31ccd97cb40b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1912838Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#715147}
parent 899c2e08
......@@ -11,6 +11,7 @@
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/containers/unique_ptr_adapters.h"
#include "base/debug/crash_logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/optional.h"
#include "base/sequenced_task_runner.h"
......@@ -46,6 +47,13 @@ class ServiceBinderImpl {
~ServiceBinderImpl() = default;
void BindServiceInterface(mojo::GenericPendingReceiver* receiver) {
// Set a crash key so utility process crash reports indicate which service
// was running in the process.
static auto* service_name_crash_key = base::debug::AllocateCrashKeyString(
"service-name", base::debug::CrashKeySize::Size32);
base::debug::SetCrashKeyString(service_name_crash_key,
receiver->interface_name().value());
// We watch for and terminate on PEER_CLOSED, but we also terminate if the
// watcher is cancelled (meaning the local endpoint was closed rather than
// the peer). Hence any breakage of the service pipe leads to termination.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment