xuxiandi / angleproject

Automatically exported from code.google.com/p/angleproject
Other
0 stars 0 forks source link

Leaks beneath ScanFromString seen when running WebKit regression tests #249

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Checkout WebKit on a Mac
2. build-webkit --debug
3. run-webkit-tests --leaks

What is the expected output? What do you see instead?
A leak beneath ScanFromString is reported:

Leak: 0x7ff50fdec060  size=48  zone: DefaultMallocZone_0x10b8f1000
        0x0ec3c650 0x00000001 0x0e1150a0 0x00000001     P........P......
        0x0e116b60 0x00000001 0x0e116cb0 0x00000001     `k.......l......
        0x00000000 0x00000003 0x0fd305de 0x00007ff5     ................
        Call stack: [thread 0x7fff7360d960]: | 0x2 | start | main DumpRenderTree.mm:835 | dumpRenderTree(int, char const**) DumpRenderTree.mm:794 | _ZL20runTestingServerLoopv DumpRenderTree.mm:744 | _ZL7runTestRKSs DumpRenderTree.mm:1273 | -[NSRunLoop(NSRunLoop) runMode:beforeDate:] | CFRunLoopRunSpecific | __CFRunLoopRun | __CFRunLoopDoSources0 | __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ | MultiplexerSource::perform() | URLConnectionClient::processEvents() | URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) | URLConnectionClient::_clientDidReceiveData(__CFArray const*, URLConnectionClient::ClientConnectionEventQueue*) | _NSURLConnectionDidReceiveData | ___NSURLConnectionDidReceiveData_block_invoke_1 | -[WebCoreResourceHandleAsDelegate connection:didReceiveData:lengthReceived:] ResourceHandleMac.mm:846 | WebCore::ResourceLoader::didReceiveData(WebCore::ResourceHandle*, char const*, int, int) ResourceLoader.cpp:442 | WebCore::MainResourceLoader::didReceiveData(char const*, int, long long, bool) MainResourceLoader.cpp:468 | WebCore::ResourceLoader::didReceiveData(char const*, int, long long, bool) ResourceLoader.cpp:291 | WebCore::MainResourceLoader::addData(char const*, int, bool) MainResourceLoader.cpp:169 | WebCore::DocumentLoader::receivedData(char const*, int) DocumentLoader.cpp:330 | WebCore::DocumentLoader::commitLoad(char const*, int) DocumentLoader.cpp:304 | WebFrameLoaderClient::committedLoad(WebCore::DocumentLoader*, char const*, int) WebFrameLoaderClient.mm:890 | -[WebDataSource(WebInternal) _receivedData:] WebDataSource.mm:233 | -[WebHTMLRepresentation receivedData:withDataSource:] WebHTMLRepresentation.mm:185 | -[WebFrame(WebInternal) _commitData:] WebFrame.mm:846 | WebCore::DocumentLoader::commitData(char const*, unsigned long) DocumentLoader.cpp:318 | WebCore::DocumentWriter::addData(char const*, unsigned long) DocumentWriter.cpp:207 | WebCore::DecodedDataDocumentParser::appendBytes(WebCore::DocumentWriter*, char const*, unsigned long) DecodedDataDocumentParser.cpp:50 | WebCore::HTMLDocumentParser::append(WebCore::SegmentedString const&) HTMLDocumentParser.cpp:372 | WebCore::HTMLDocumentParser::pumpTokenizerIfPossible(WebCore::HTMLDocumentParser::SynchronousMode) HTMLDocumentParser.cpp:178 | WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode) HTMLDocumentParser.cpp:263 | WebCore::HTMLDocumentParser::canTakeNextToken(WebCore::HTMLDocumentParser::SynchronousMode, WebCore::PumpSession&) HTMLDocumentParser.cpp:225 | WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder() HTMLDocumentParser.cpp:207 | WebCore::HTMLScriptRunner::execute(WTF::PassRefPtr<WebCore::Element>, WTF::TextPosition const&) HTMLScriptRunner.cpp:172 | WebCore::HTMLScriptRunner::runScript(WebCore::Element*, WTF::TextPosition const&) HTMLScriptRunner.cpp:298 | WebCore::ScriptElement::prepareScript(WTF::TextPosition const&, WebCore::ScriptElement::LegacyTypeSupport) ScriptElement.cpp:250 | WebCore::ScriptElement::executeScript(WebCore::ScriptSourceCode const&) ScriptElement.cpp:301 | WebCore::ScriptController::evaluate(WebCore::ScriptSourceCode const&) ScriptController.cpp:164 | WebCore::ScriptController::evaluateInWorld(WebCore::ScriptSourceCode const&, WebCore::DOMWrapperWorld*) ScriptController.cpp:146 | WebCore::JSMainThreadExecState::evaluate(JSC::ExecState*, JSC::ScopeChainNode*, JSC::SourceCode const&, JSC::JSValue, JSC::JSValue*) JSMainThreadExecState.h:58 | JSC::evaluate(JSC::ExecState*, JSC::ScopeChainNode*, JSC::SourceCode const&, JSC::JSValue, JSC::JSValue*) Completion.cpp:70 | JSC::Interpreter::execute(JSC::ProgramExecutable*, JSC::ExecState*, JSC::ScopeChainNode*, JSC::JSObject*) Interpreter.cpp:1002 | JSC::JITCode::execute(JSC::RegisterFile*, JSC::ExecState*, JSC::JSGlobalData*) JITCode.h:115 | 0x5ed1f8c01218 | WebCore::jsWebGLRenderingContextPrototypeFunctionCompileShader(JSC::ExecState*) JSWebGLRenderingContext.cpp:1530 | WebCore::WebGLRenderingContext::compileShader(WebCore::WebGLShader*, int&) WebGLRenderingContext.cpp:1164 | WebCore::GraphicsContext3D::compileShader(unsigned int) GraphicsContext3DOpenGL.cpp:535 | WebCore::ANGLEWebKitBridge::validateShaderSource(char const*, WebCore::ANGLEShaderType, WTF::String&, WTF::String&) ANGLEWebKitBridge.cpp:91 | ShCompile | TCompiler::compile(char const* const*, int, int) | PaParseStrings(int, char const* const*, int const*, TParseContext*) | glslang_scan(int, char const* const*, int const*, TParseContext*) | ScanFromString | malloc | malloc_zone_malloc  
Leak: 0x7ff511856a80  size=48  zone: DefaultMallocZone_0x10b8f1000
        0x0ec3c650 0x00000001 0x0e1150a0 0x00000001     P........P......
        0x0e116b60 0x00000001 0x0e116cb0 0x00000001     `k.......l......
        0x00000000 0x00000001 0x11856a64 0x00007ff5     ........dj......
        Call stack: [thread 0x7fff7360d960]: | 0x2 | start | main DumpRenderTree.mm:835 | dumpRenderTree(int, char const**) DumpRenderTree.mm:794 | _ZL20runTestingServerLoopv DumpRenderTree.mm:744 | _ZL7runTestRKSs DumpRenderTree.mm:1273 | -[NSRunLoop(NSRunLoop) runMode:beforeDate:] | CFRunLoopRunSpecific | __CFRunLoopRun | __CFRunLoopDoSources0 | __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ | MultiplexerSource::perform() | URLConnectionClient::processEvents() | URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) | URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) | URLConnectionClient::_clientDidReceiveData(__CFArray const*, URLConnectionClient::ClientConnectionEventQueue*) | _NSURLConnectionDidReceiveData | ___NSURLConnectionDidReceiveData_block_invoke_1 | -[WebCoreResourceHandleAsDelegate connection:didReceiveData:lengthReceived:] ResourceHandleMac.mm:846 | WebCore::ResourceLoader::didReceiveData(WebCore::ResourceHandle*, char const*, int, int) ResourceLoader.cpp:442 | WebCore::MainResourceLoader::didReceiveData(char const*, int, long long, bool) MainResourceLoader.cpp:468 | WebCore::ResourceLoader::didReceiveData(char const*, int, long long, bool) ResourceLoader.cpp:291 | WebCore::MainResourceLoader::addData(char const*, int, bool) MainResourceLoader.cpp:169 | WebCore::DocumentLoader::receivedData(char const*, int) DocumentLoader.cpp:330 | WebCore::DocumentLoader::commitLoad(char const*, int) DocumentLoader.cpp:304 | WebFrameLoaderClient::committedLoad(WebCore::DocumentLoader*, char const*, int) WebFrameLoaderClient.mm:890 | -[WebDataSource(WebInternal) _receivedData:] WebDataSource.mm:233 | -[WebHTMLRepresentation receivedData:withDataSource:] WebHTMLRepresentation.mm:185 | -[WebFrame(WebInternal) _commitData:] WebFrame.mm:846 | WebCore::DocumentLoader::commitData(char const*, unsigned long) DocumentLoader.cpp:318 | WebCore::DocumentWriter::addData(char const*, unsigned long) DocumentWriter.cpp:207 | WebCore::DecodedDataDocumentParser::appendBytes(WebCore::DocumentWriter*, char const*, unsigned long) DecodedDataDocumentParser.cpp:50 | WebCore::HTMLDocumentParser::append(WebCore::SegmentedString const&) HTMLDocumentParser.cpp:372 | WebCore::HTMLDocumentParser::pumpTokenizerIfPossible(WebCore::HTMLDocumentParser::SynchronousMode) HTMLDocumentParser.cpp:178 | WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode) HTMLDocumentParser.cpp:263 | WebCore::HTMLDocumentParser::canTakeNextToken(WebCore::HTMLDocumentParser::SynchronousMode, WebCore::PumpSession&) HTMLDocumentParser.cpp:225 | WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder() HTMLDocumentParser.cpp:207 | WebCore::HTMLScriptRunner::execute(WTF::PassRefPtr<WebCore::Element>, WTF::TextPosition const&) HTMLScriptRunner.cpp:172 | WebCore::HTMLScriptRunner::runScript(WebCore::Element*, WTF::TextPosition const&) HTMLScriptRunner.cpp:298 | WebCore::ScriptElement::prepareScript(WTF::TextPosition const&, WebCore::ScriptElement::LegacyTypeSupport) ScriptElement.cpp:250 | WebCore::ScriptElement::executeScript(WebCore::ScriptSourceCode const&) ScriptElement.cpp:301 | WebCore::ScriptController::evaluate(WebCore::ScriptSourceCode const&) ScriptController.cpp:164 | WebCore::ScriptController::evaluateInWorld(WebCore::ScriptSourceCode const&, WebCore::DOMWrapperWorld*) ScriptController.cpp:146 | WebCore::JSMainThreadExecState::evaluate(JSC::ExecState*, JSC::ScopeChainNode*, JSC::SourceCode const&, JSC::JSValue, JSC::JSValue*) JSMainThreadExecState.h:58 | JSC::evaluate(JSC::ExecState*, JSC::ScopeChainNode*, JSC::SourceCode const&, JSC::JSValue, JSC::JSValue*) Completion.cpp:70 | JSC::Interpreter::execute(JSC::ProgramExecutable*, JSC::ExecState*, JSC::ScopeChainNode*, JSC::JSObject*) Interpreter.cpp:1002 | JSC::JITCode::execute(JSC::RegisterFile*, JSC::ExecState*, JSC::JSGlobalData*) JITCode.h:115 | 0x5ed1f8c01218 | WebCore::jsWebGLRenderingContextPrototypeFunctionCompileShader(JSC::ExecState*) JSWebGLRenderingContext.cpp:1530 | WebCore::WebGLRenderingContext::compileShader(WebCore::WebGLShader*, int&) WebGLRenderingContext.cpp:1164 | WebCore::GraphicsContext3D::compileShader(unsigned int) GraphicsContext3DOpenGL.cpp:535 | WebCore::ANGLEWebKitBridge::validateShaderSource(char const*, WebCore::ANGLEShaderType, WTF::String&, WTF::String&) ANGLEWebKitBridge.cpp:91 | ShCompile | TCompiler::compile(char const* const*, int, int) | PaParseStrings(int, char const* const*, int const*, TParseContext*) | glslang_scan(int, char const* const*, int const*, TParseContext*) | ScanFromString | malloc | malloc_zone_malloc  
Leak: 0x7ff511858de0  size=48  zone: DefaultMallocZone_0x10b8f1000
        0x0ec3c650 0x00000001 0x0e1150a0 0x00000001     P........P......
        0x0e116b60 0x00000001 0x0e116cb0 0x00000001     `k.......l......
        0x00000000 0x00000001 0x11858714 0x00007ff5     ................
        Call stack: [thread 0x7fff7360d960]: | 0x2 | start | main DumpRenderTree.mm:835 | dumpRenderTree(int, char const**) DumpRenderTree.mm:794 | _ZL20runTestingServerLoopv DumpRenderTree.mm:744 | _ZL7runTestRKSs DumpRenderTree.mm:1273 | -[NSRunLoop(NSRunLoop) runMode:beforeDate:] | CFRunLoopRunSpecific | __CFRunLoopRun | __CFRunLoopDoSources0 | __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ | MultiplexerSource::perform() | URLConnectionClient::processEvents() | URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) | URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) | URLConnectionClient::_clientDidReceiveData(__CFArray const*, URLConnectionClient::ClientConnectionEventQueue*) | _NSURLConnectionDidReceiveData | ___NSURLConnectionDidReceiveData_block_invoke_1 | -[WebCoreResourceHandleAsDelegate connection:didReceiveData:lengthReceived:] ResourceHandleMac.mm:846 | WebCore::ResourceLoader::didReceiveData(WebCore::ResourceHandle*, char const*, int, int) ResourceLoader.cpp:442 | WebCore::MainResourceLoader::didReceiveData(char const*, int, long long, bool) MainResourceLoader.cpp:468 | WebCore::ResourceLoader::didReceiveData(char const*, int, long long, bool) ResourceLoader.cpp:291 | WebCore::MainResourceLoader::addData(char const*, int, bool) MainResourceLoader.cpp:169 | WebCore::DocumentLoader::receivedData(char const*, int) DocumentLoader.cpp:330 | WebCore::DocumentLoader::commitLoad(char const*, int) DocumentLoader.cpp:304 | WebFrameLoaderClient::committedLoad(WebCore::DocumentLoader*, char const*, int) WebFrameLoaderClient.mm:890 | -[WebDataSource(WebInternal) _receivedData:] WebDataSource.mm:233 | -[WebHTMLRepresentation receivedData:withDataSource:] WebHTMLRepresentation.mm:185 | -[WebFrame(WebInternal) _commitData:] WebFrame.mm:846 | WebCore::DocumentLoader::commitData(char const*, unsigned long) DocumentLoader.cpp:318 | WebCore::DocumentWriter::addData(char const*, unsigned long) DocumentWriter.cpp:207 | WebCore::DecodedDataDocumentParser::appendBytes(WebCore::DocumentWriter*, char const*, unsigned long) DecodedDataDocumentParser.cpp:50 | WebCore::HTMLDocumentParser::append(WebCore::SegmentedString const&) HTMLDocumentParser.cpp:372 | WebCore::HTMLDocumentParser::pumpTokenizerIfPossible(WebCore::HTMLDocumentParser::SynchronousMode) HTMLDocumentParser.cpp:178 | WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode) HTMLDocumentParser.cpp:263 | WebCore::HTMLDocumentParser::canTakeNextToken(WebCore::HTMLDocumentParser::SynchronousMode, WebCore::PumpSession&) HTMLDocumentParser.cpp:225 | WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder() HTMLDocumentParser.cpp:207 | WebCore::HTMLScriptRunner::execute(WTF::PassRefPtr<WebCore::Element>, WTF::TextPosition const&) HTMLScriptRunner.cpp:172 | WebCore::HTMLScriptRunner::runScript(WebCore::Element*, WTF::TextPosition const&) HTMLScriptRunner.cpp:298 | WebCore::ScriptElement::prepareScript(WTF::TextPosition const&, WebCore::ScriptElement::LegacyTypeSupport) ScriptElement.cpp:250 | WebCore::ScriptElement::executeScript(WebCore::ScriptSourceCode const&) ScriptElement.cpp:301 | WebCore::ScriptController::evaluate(WebCore::ScriptSourceCode const&) ScriptController.cpp:164 | WebCore::ScriptController::evaluateInWorld(WebCore::ScriptSourceCode const&, WebCore::DOMWrapperWorld*) ScriptController.cpp:146 | WebCore::JSMainThreadExecState::evaluate(JSC::ExecState*, JSC::ScopeChainNode*, JSC::SourceCode const&, JSC::JSValue, JSC::JSValue*) JSMainThreadExecState.h:58 | JSC::evaluate(JSC::ExecState*, JSC::ScopeChainNode*, JSC::SourceCode const&, JSC::JSValue, JSC::JSValue*) Completion.cpp:70 | JSC::Interpreter::execute(JSC::ProgramExecutable*, JSC::ExecState*, JSC::ScopeChainNode*, JSC::JSObject*) Interpreter.cpp:1002 | JSC::JITCode::execute(JSC::RegisterFile*, JSC::ExecState*, JSC::JSGlobalData*) JITCode.h:115 | 0x5ed1f8c01218 | WebCore::jsWebGLRenderingContextPrototypeFunctionCompileShader(JSC::ExecState*) JSWebGLRenderingContext.cpp:1530 | WebCore::WebGLRenderingContext::compileShader(WebCore::WebGLShader*, int&) WebGLRenderingContext.cpp:1164 | WebCore::GraphicsContext3D::compileShader(unsigned int) GraphicsContext3DOpenGL.cpp:535 | WebCore::ANGLEWebKitBridge::validateShaderSource(char const*, WebCore::ANGLEShaderType, WTF::String&, WTF::String&) ANGLEWebKitBridge.cpp:91 | ShCompile | TCompiler::compile(char const* const*, int, int) | PaParseStrings(int, char const* const*, int const*, TParseContext*) | glslang_scan(int, char const* const*, int const*, TParseContext*) | ScanFromString | malloc | malloc_zone_malloc  

What version of the product are you using? On what operating system?
WebKit is using ANGLE r696, I believe. The leak was seen on OS X 10.7.2.

Original issue reported on code.google.com by adam.ro...@gmail.com on 18 Nov 2011 at 7:11

GoogleCodeExporter commented 9 years ago
From code inspection it seems that str_getch is responsible for cleaning up the 
StringInputSrc objects that ScanFromString allocates. I wonder whether the 
problem occurs if shader compilation fails and we leave a chain of InputSrc 
objects hanging off the CPPStruct.

The new preprocessor would almost surely solve this problem, but it's been 
stalled for some time. Perhaps we could collectively push to finish it.

Original comment by kbr@chromium.org on 18 Nov 2011 at 7:25

GoogleCodeExporter commented 9 years ago
The old preprocessor has been replaced with a completely rewritten one.  This 
issue should no longer be a problem. 

Original comment by dan...@transgaming.com on 26 Oct 2012 at 7:35