WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
106710
FormData and FormDataElement leak
https://bugs.webkit.org/show_bug.cgi?id=106710
Summary
FormData and FormDataElement leak
Ryosuke Niwa
Reported
2013-01-11 15:35:33 PST
It seems like we're leaking a Vector in FormData and that's accounting roughly 10% of leaks reported on the leaks bot:
http://build.webkit.org/LeaksViewer/?url=%2Fresults%2FApple%20MountainLion%20%28Leaks%29%2Fr139478%20%282325%29%2F
Attachments
original leak dump
(465.09 KB, text/plain)
2013-01-25 15:32 PST
,
Ryosuke Niwa
no flags
Details
cleaned up leaks dump
(84.95 KB, text/plain)
2013-01-25 15:33 PST
,
Ryosuke Niwa
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2013-01-24 17:02:10 PST
FormData is leaked when you run LayoutTests/http/tests/local/blob/send-data-blob.html
Ryosuke Niwa
Comment 2
2013-01-24 18:07:04 PST
It seems like we're also leaking CFReadStream in the same test: __invoking___ -[EventSendingController mouseUp:withModifiers:] EventSendingController.mm:436 -[WebView performDragOperation:] WebView.mm:4191 WebCore::DragController::performDrag(WebCore::DragData*) DragController.cpp:232 WebCore::DragController::concludeEditDrag(WebCore::DragData*) DragController.cpp:490 WebCore::HTMLInputElement::receiveDroppedFiles(WebCore::DragData const*) HTMLInputElement.cpp:1363 WebCore::FileInputType::receiveDroppedFiles(WebCore::DragData const*) FileInputType.cpp:430 WebCore::FileInputType::filesChosen(WTF::Vector<WebCore::FileChooserFileInfo, 0ul> const&) FileInputType.cpp:377 WebCore::FileInputType::setFiles(WTF::PassRefPtr<WebCore::FileList>) FileInputType.cpp:370 WebCore::Node::dispatchChangeEvent() Node.cpp:2433 WebCore::Node::dispatchScopedEvent(WTF::PassRefPtr<WebCore::Event>) Node.cpp:2322 WebCore::Node::dispatchScopedEventDispatchMediator(WTF::PassRefPtr<WebCore::EventDispatchMediator>) Node.cpp:2327 WebCore::EventDispatcher::dispatchScopedEvent(WebCore::Node*, WTF::PassRefPtr<WebCore::EventDispatchMediator>) EventDispatcher.cpp:216 WebCore::ScopedEventQueue::enqueueEventDispatchMediator(WTF::PassRefPtr<WebCore::EventDispatchMediator>) ScopedEventQueue.cpp:68 WebCore::ScopedEventQueue::dispatchEvent(WTF::PassRefPtr<WebCore::EventDispatchMediator>) const ScopedEventQueue.cpp:84 WebCore::EventDispatcher::dispatchEvent(WebCore::Node*, WTF::PassRefPtr<WebCore::EventDispatchMediator>) EventDispatcher.cpp:135 WebCore::EventDispatchMediator::dispatchEvent(WebCore::EventDispatcher*) const EventDispatchMediator.cpp:52 WebCore::EventDispatcher::dispatchEvent(WTF::PassRefPtr<WebCore::Event>) EventDispatcher.cpp:267 WebCore::EventDispatcher::dispatchEventAtTarget(WTF::PassRefPtr<WebCore::Event>) EventDispatcher.cpp:315 WebCore::EventContext::handleLocalEvents(WebCore::Event*) const EventContext.cpp:55 WebCore::Node::handleLocalEvents(WebCore::Event*) Node.cpp:2317 WebCore::EventTarget::fireEventListeners(WebCore::Event*) EventTarget.cpp:203 WebCore::EventTarget::fireEventListeners(WebCore::Event*, WebCore::EventTargetData*, WTF::Vector<WebCore::RegisteredEventListener, 1ul>&) EventTarget.cpp:257 WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) JSEventListener.cpp:129 WebCore::JSMainThreadExecState::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) JSMainThreadExecState.h:56 JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:40 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) Interpreter.cpp:1055 JSC::JITCode::execute(JSC::JSStack*, JSC::ExecState*, JSC::JSGlobalData*) JITCode.h:135 0x35b6b5401045 WebCore::jsXMLHttpRequestPrototypeFunctionSend(JSC::ExecState*) JSXMLHttpRequest.cpp:632 WebCore::JSXMLHttpRequest::send(JSC::ExecState*) JSXMLHttpRequestCustom.cpp:125 WebCore::XMLHttpRequest::send(WebCore::Blob*, int&) XMLHttpRequest.cpp:680 WebCore::XMLHttpRequest::createRequest(int&) XMLHttpRequest.cpp:824 WebCore::ThreadableLoader::loadResourceSynchronously(WebCore::ScriptExecutionContext*, WebCore::ResourceRequest const&, WebCore::ThreadableLoaderClient&, WebCore::ThreadableLoaderOptions const&) ThreadableLoader.cpp:70 WebCore::DocumentThreadableLoader::loadResourceSynchronously(WebCore::Document*, WebCore::ResourceRequest const&, WebCore::ThreadableLoaderClient&, WebCore::ThreadableLoaderOptions const&) DocumentThreadableLoader.cpp:62 WebCore::DocumentThreadableLoader::DocumentThreadableLoader(WebCore::Document*, WebCore::ThreadableLoaderClient*, WebCore::DocumentThreadableLoader::BlockingBehavior, WebCore::ResourceRequest const&, WebCore::ThreadableLoaderOptions const&) DocumentThreadableLoader.cpp:101 WebCore::DocumentThreadableLoader::DocumentThreadableLoader(WebCore::Document*, WebCore::ThreadableLoaderClient*, WebCore::DocumentThreadableLoader::BlockingBehavior, WebCore::ResourceRequest const&, WebCore::ThreadableLoaderOptions const&) DocumentThreadableLoader.cpp:92 WebCore::DocumentThreadableLoader::loadRequest(WebCore::ResourceRequest const&, WebCore::SecurityCheckPolicy) DocumentThreadableLoader.cpp:409 WebCore::FrameLoader::loadResourceSynchronously(WebCore::ResourceRequest const&, WebCore::StoredCredentials, WebCore::ResourceError&, WebCore::ResourceResponse&, WTF::Vector<char, 0ul>&) FrameLoader.cpp:2582 WebCore::FrameLoader::requestFromDelegate(WebCore::ResourceRequest&, unsigned long&, WebCore::ResourceError&) FrameLoader.cpp:2876 WebCore::ResourceLoadNotifier::assignIdentifierToInitialRequest(unsigned long, WebCore::DocumentLoader*, WebCore::ResourceRequest const&) ResourceLoadNotifier.cpp:106 WebFrameLoaderClient::assignIdentifierToInitialRequest(unsigned long, WebCore::DocumentLoader*, WebCore::ResourceRequest const&) WebFrameLoaderClient.mm:325 WebCore::ResourceRequest::nsURLRequest() const ResourceRequestMac.mm:54 WebCore::ResourceRequestBase::updatePlatformRequest() const ResourceRequestBase.cpp:479 WebCore::ResourceRequest::doUpdatePlatformRequest() ResourceRequestMac.mm:177 WebCore::setHTTPBody(NSMutableURLRequest*, WTF::PassRefPtr<WebCore::FormData>) FormDataStreamMac.mm:46 WebCore::setHTTPBody(_CFURLRequest*, WTF::PassRefPtr<WebCore::FormData>) FormDataStreamCFNet.cpp:421 CFURLRequestSetHTTPRequestBodyStream CoreReadStreamCreateWithCFReadStream(__CFAllocator const*, __CFReadStream*) CFObject::Allocate(unsigned long, CFClass const&, __CFAllocator const*) _CFRuntimeCreateInstance malloc_zone_malloc
Ryosuke Niwa
Comment 3
2013-01-24 18:08:32 PST
Sorry, wrong stack trace. -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke_0 -[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:] ResourceHandleMac.mm:823 WebCore::ResourceLoader::didFinishLoading(WebCore::ResourceHandle*, double) ResourceLoader.cpp:458 WebCore::SubresourceLoader::didFinishLoading(double) SubresourceLoader.cpp:278 WebCore::CachedScript::data(WTF::PassRefPtr<WebCore::ResourceBuffer>, bool) CachedScript.cpp:91 WebCore::CachedResource::checkNotify() CachedResource.cpp:336 non-virtual thunk to WebCore::HTMLDocumentParser::notifyFinished(WebCore::CachedResource*) WebCore::HTMLDocumentParser::notifyFinished(WebCore::CachedResource*) HTMLDocumentParser.cpp:718 WebCore::HTMLDocumentParser::resumeParsingAfterScriptExecution() HTMLDocumentParser.cpp:678 WebCore::HTMLDocumentParser::pumpTokenizerIfPossible(WebCore::HTMLDocumentParser::SynchronousMode) HTMLDocumentParser.cpp:205 WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode) HTMLDocumentParser.cpp:345 WebCore::HTMLDocumentParser::canTakeNextToken(WebCore::HTMLDocumentParser::SynchronousMode, WebCore::PumpSession&) HTMLDocumentParser.cpp:253 WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder() HTMLDocumentParser.cpp:233 WebCore::HTMLScriptRunner::execute(WTF::PassRefPtr<WebCore::Element>, WTF::TextPosition const&) HTMLScriptRunner.cpp:180 WebCore::HTMLScriptRunner::executeParsingBlockingScripts() HTMLScriptRunner.cpp:190 WebCore::HTMLScriptRunner::executeParsingBlockingScript() HTMLScriptRunner.cpp:118 WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent(WebCore::PendingScript&) HTMLScriptRunner.cpp:139 WebCore::ScriptElement::executeScript(WebCore::ScriptSourceCode const&) ScriptElement.cpp:304 WebCore::ScriptController::evaluate(WebCore::ScriptSourceCode const&) ScriptController.cpp:158 WebCore::ScriptController::evaluateInWorld(WebCore::ScriptSourceCode const&, WebCore::DOMWrapperWorld*) ScriptController.cpp:141 WebCore::JSMainThreadExecState::evaluate(JSC::ExecState*, JSC::SourceCode const&, JSC::JSValue, JSC::JSValue*) JSMainThreadExecState.h:77 JSC::evaluate(JSC::ExecState*, JSC::SourceCode const&, JSC::JSValue, JSC::JSValue*) Completion.cpp:75 JSC::Interpreter::execute(JSC::ProgramExecutable*, JSC::ExecState*, JSC::JSObject*) Interpreter.cpp:983 JSC::JITCode::execute(JSC::JSStack*, JSC::ExecState*, JSC::JSGlobalData*) JITCode.h:135 0x26b819401045 WebCore::jsXMLHttpRequestPrototypeFunctionSend(JSC::ExecState*) JSXMLHttpRequest.cpp:632 WebCore::JSXMLHttpRequest::send(JSC::ExecState*) JSXMLHttpRequestCustom.cpp:125 WebCore::XMLHttpRequest::send(WebCore::Blob*, int&) XMLHttpRequest.cpp:680 WebCore::XMLHttpRequest::createRequest(int&) XMLHttpRequest.cpp:824 WebCore::ThreadableLoader::loadResourceSynchronously(WebCore::ScriptExecutionContext*, WebCore::ResourceRequest const&, WebCore::ThreadableLoaderClient&, WebCore::ThreadableLoaderOptions const&) ThreadableLoader.cpp:70 WebCore::DocumentThreadableLoader::loadResourceSynchronously(WebCore::Document*, WebCore::ResourceRequest const&, WebCore::ThreadableLoaderClient&, WebCore::ThreadableLoaderOptions const&) DocumentThreadableLoader.cpp:62 WebCore::DocumentThreadableLoader::DocumentThreadableLoader(WebCore::Document*, WebCore::ThreadableLoaderClient*, WebCore::DocumentThreadableLoader::BlockingBehavior, WebCore::ResourceRequest const&, WebCore::ThreadableLoaderOptions const&) DocumentThreadableLoader.cpp:101 WebCore::DocumentThreadableLoader::DocumentThreadableLoader(WebCore::Document*, WebCore::ThreadableLoaderClient*, WebCore::DocumentThreadableLoader::BlockingBehavior, WebCore::ResourceRequest const&, WebCore::ThreadableLoaderOptions const&) DocumentThreadableLoader.cpp:92 WebCore::DocumentThreadableLoader::loadRequest(WebCore::ResourceRequest const&, WebCore::SecurityCheckPolicy) DocumentThreadableLoader.cpp:409 WebCore::FrameLoader::loadResourceSynchronously(WebCore::ResourceRequest const&, WebCore::StoredCredentials, WebCore::ResourceError&, WebCore::ResourceResponse&, WTF::Vector<char, 0ul>&) FrameLoader.cpp:2582 WebCore::FrameLoader::requestFromDelegate(WebCore::ResourceRequest&, unsigned long&, WebCore::ResourceError&) FrameLoader.cpp:2876 WebCore::ResourceLoadNotifier::assignIdentifierToInitialRequest(unsigned long, WebCore::DocumentLoader*, WebCore::ResourceRequest const&) ResourceLoadNotifier.cpp:106 WebFrameLoaderClient::assignIdentifierToInitialRequest(unsigned long, WebCore::DocumentLoader*, WebCore::ResourceRequest const&) WebFrameLoaderClient.mm:325 WebCore::ResourceRequest::nsURLRequest() const ResourceRequestMac.mm:54 WebCore::ResourceRequestBase::updatePlatformRequest() const ResourceRequestBase.cpp:479 WebCore::ResourceRequest::doUpdatePlatformRequest() ResourceRequestMac.mm:177 WebCore::setHTTPBody(NSMutableURLRequest*, WTF::PassRefPtr<WebCore::FormData>) FormDataStreamMac.mm:46 WebCore::setHTTPBody(_CFURLRequest*, WTF::PassRefPtr<WebCore::FormData>) FormDataStreamCFNet.cpp:421 CFURLRequestSetHTTPRequestBodyStream CoreReadStreamCreateWithCFReadStream(__CFAllocator const*, __CFReadStream*) CFObject::Allocate(unsigned long, CFClass const&, __CFAllocator const*) _CFRuntimeCreateInstance malloc_zone_malloc
Ryosuke Niwa
Comment 4
2013-01-25 15:25:24 PST
In ResourceRequest::doUpdateResourceRequest, if I comment out the line where it assigns formData to m_httpBody, the leaks disappear, including the bodyStream temporarily allocated here. void ResourceRequest::doUpdateResourceRequest() { ... if (NSData* bodyData = [m_nsRequest.get() HTTPBody]) m_httpBody = FormData::create([bodyData bytes], [bodyData length]); else if (NSInputStream* bodyStream = [m_nsRequest.get() HTTPBodyStream]) { if (FormData* formData = adoptRef(httpBodyFromStream(bodyStream))) m_httpBody = formData; // comment out this line! (also the declaration of formData above to compile) }
Ryosuke Niwa
Comment 5
2013-01-25 15:32:08 PST
Created
attachment 184816
[details]
original leak dump
Ryosuke Niwa
Comment 6
2013-01-25 15:33:24 PST
Created
attachment 184818
[details]
cleaned up leaks dump
Ryosuke Niwa
Comment 7
2013-03-18 16:31:41 PDT
***
Bug 112498
has been marked as a duplicate of this bug. ***
Alexey Proskuryakov
Comment 8
2016-02-24 09:32:45 PST
rdar://problem/13437245
Alexey Proskuryakov
Comment 9
2016-02-25 16:54:41 PST
This is an issue below WebKit; see
rdar://problem/13437245
Alexey Proskuryakov
Comment 10
2016-02-25 16:57:33 PST
***
Bug 150546
has been marked as a duplicate of this bug. ***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug