Commit 6296e827 authored by Maks Orlovich's avatar Maks Orlovich Committed by Commit Bot

URLLoader: add debug info to catch a leak again.

This time with a DumpWithoutCrashing

Bug: 901405
Change-Id: Ie2a075afe384e3dc13fde076a558d5d90591ab92
Reviewed-on: https://chromium-review.googlesource.com/c/1330076Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606987}
parent 834fcb0a
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "base/debug/alias.h"
#include "base/debug/dump_without_crashing.h"
#include "base/files/file.h" #include "base/files/file.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
...@@ -42,12 +44,16 @@ ...@@ -42,12 +44,16 @@
namespace network { namespace network {
namespace { namespace {
constexpr size_t kDefaultAllocationSize = 512 * 1024; constexpr size_t kDefaultAllocationSize = 512 * 1024;
// Cannot use 0, because this means "default" in // Cannot use 0, because this means "default" in
// mojo::core::Core::CreateDataPipe // mojo::core::Core::CreateDataPipe
constexpr size_t kBlockedBodyAllocationSize = 1; constexpr size_t kBlockedBodyAllocationSize = 1;
// Used to dump when we get too many requests, once.
bool g_reported_too_many_requests = false;
// TODO: this duplicates some of PopulateResourceResponse in // TODO: this duplicates some of PopulateResourceResponse in
// content/browser/loader/resource_loader.cc // content/browser/loader/resource_loader.cc
void PopulateResourceResponse(net::URLRequest* request, void PopulateResourceResponse(net::URLRequest* request,
...@@ -404,6 +410,18 @@ URLLoader::URLLoader( ...@@ -404,6 +410,18 @@ URLLoader::URLLoader(
if (keepalive_ && keepalive_statistics_recorder_) if (keepalive_ && keepalive_statistics_recorder_)
keepalive_statistics_recorder_->OnLoadStarted(factory_params_->process_id); keepalive_statistics_recorder_->OnLoadStarted(factory_params_->process_id);
// Record some debug info in hope of tracing down leaks.
int32_t annotation_hash =
url_request_->traffic_annotation().unique_id_hash_code;
size_t num_running_requests = url_request_context_->url_requests()->size();
base::debug::Alias(&annotation_hash);
base::debug::Alias(&num_running_requests);
DEBUG_ALIAS_FOR_GURL(url_buf, url_request_->url());
if (!g_reported_too_many_requests && num_running_requests > 10000) {
g_reported_too_many_requests = true;
base::debug::DumpWithoutCrashing();
}
// Resolve elements from request_body and prepare upload data. // Resolve elements from request_body and prepare upload data.
if (request.request_body.get()) { if (request.request_body.get()) {
OpenFilesForUpload(request); OpenFilesForUpload(request);
......
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