Version: 54.0.2832.2
OS: all
I'm trying to return an error from NetworkDelegate::OnBeforeStartTransaction(). Depending on the type of request, I'm ending up in some bad places.
For example, an SdchDictionaryFetcher notices we're trying to start a nested fetch loop:
[1068:5812:0902/095833:245125484:FATAL:sdch_dictionary_fetcher.cc(162)] Check failed: !in_loop_.
Backtrace:
base::debug::StackTrace::StackTrace
logging::LogMessage::~LogMessage() Line 533
net::SdchDictionaryFetcher::OnResponseStarted() Line 167
net::URLRequest::NotifyResponseStarted() Line 825
net::URLRequestJob::NotifyStartError() Line 626
net::URLRequestHttpJob::MaybeStartTransactionInternal() Line 581
net::URLRequestHttpJob::StartTransaction() Line 555
net::URLRequestHttpJob::DoStartTransaction() Line 820
net::URLRequestHttpJob::AddCookieHeaderAndStart() Line 804
net::URLRequestHttpJob::Start() Line 400
net::URLRequest::StartJob() Line 665
net::URLRequest::BeforeRequestComplete() Line 610
net::URLRequest::Start() Line 533
net::SdchDictionaryFetcher::DoSendRequest() Line 293
net::SdchDictionaryFetcher::DoLoop() Line 241
net::SdchDictionaryFetcher::ScheduleInternal() Line 221
net::SdchDictionaryFetcher::ScheduleReload() Line 136
net::SdchOwner::SchedulePersistedDictionaryLoads() Line 732
net::SdchOwner::OnPrefStorageInitializationComplete() Line 632
chrome_browser_net::SdchOwnerPrefStorage::OnInitializationCompleted() Line 110
JsonPrefStore::FinalizeFileRead() Line 440
JsonPrefStore::OnFileRead() Line 391
In another example, a content::ResourceLoader effectively self-destructs while executing StartRequestInternal(). The call stack below illustrates what happens right before attempting the delegate_->DidStartRequest(this) call in StartRequestInternal().
content::ResourceDispatcherHostImpl::RemovePendingLoader() Line 2027
content::ResourceDispatcherHostImpl::RemovePendingRequest() Line 2022
content::ResourceDispatcherHostImpl::DidFinishLoading() Line 1063
content::ResourceLoader::CallDidFinishLoading() Line 698
content::ResourceLoader::ResponseCompleted() Line 692
content::ResourceLoader::OnResponseStarted() Line 353
net::URLRequest::NotifyResponseStarted() Line 825
net::URLRequestJob::NotifyStartError() Line 626
net::URLRequestHttpJob::MaybeStartTransactionInternal() Line 603
net::URLRequestHttpJob::StartTransaction() Line 577
net::URLRequestHttpJob::DoStartTransaction() Line 845
net::URLRequestHttpJob::AddCookieHeaderAndStart() Line 829
net::URLRequestHttpJob::Start() Line 402
net::URLRequest::StartJob() Line 665
net::URLRequest::BeforeRequestComplete() Line 610
net::URLRequest::Start() Line 533
content::ResourceLoader::StartRequestInternal() Line 499
content::ResourceLoader::StartRequest() Line 189
content::ResourceDispatcherHostImpl::StartLoading() Line 2376
content::ResourceDispatcherHostImpl::BeginRequestInternal() Line 2362
content::ResourceDispatcherHostImpl::BeginRequest() Line 1568
content::ResourceDispatcherHostImpl::OnRequestResource() Line 1171
From the discussion in https://groups.google.com/a/chromium.org/d/topic/net-dev/v-ckbav2hac/discussion, this is because URLRequestHttpJob calls URLRequestJob::NotifyStartError() synchronously, which the URLRequest doesn't allow. The same applies to NotifyHeadersComplete().
Comment 1 by mmenke@chromium.org
, Sep 6 2016