<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>129792</bug_id>
          
          <creation_ts>2014-03-06 01:47:48 -0800</creation_ts>
          <short_desc>[Mac] Leak: dispatch_semaphore leak allocated in MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange</short_desc>
          <delta_ts>2014-03-06 09:59:41 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>eric.carlson</cc>
    
    <cc>glenn</cc>
    
    <cc>jer.noble</cc>
    
    <cc>philipj</cc>
    
    <cc>sergio</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>987622</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2014-03-06 01:47:48 -0800</bug_when>
    <thetext>Seen on the leaks bot:
&lt;http://build.webkit.org/builders/Apple%20MountainLion%20%28Leaks%29/builds/9535/steps/layout-test/logs/stdio&gt;

Leak: 0x7fb97b2a39b0  size=112  zone: DefaultMallocZone_0x100eb0000   OS_dispatch_semaphore  ObjC  libdispatch.dylib
	0x781082a8 0x00007fff 0x00000000 0x00000000 	...x............
	0x89abcdef 0xffffffff 0x78109d00 0x00007fff 	...........x....
	0x00000000 0x00000000 0x00000000 0x00000000 	................
	0x00000000 0x00000000 0x00000000 0x00000000 	................
	0x00000000 0x00000000 0x00000000 0x00000000 	................
	0x0000232b 0x00000000 0x00000000 0x00000000 	+#..............
	0x00000000 0x00000000 0x00000000 0x00000000 	................
	Call stack: [thread 0x7fff78de5180]: 
        | 0x2 
        | start 
        | main DumpRenderTreeMain.mm:30 
        | DumpRenderTreeMain(int, char const**) DumpRenderTree.mm:1277 
        | dumpRenderTree(int, char const**) DumpRenderTree.mm:1169 
        | runTestingServerLoop() DumpRenderTree.mm:1085 
        | runTest(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;) DumpRenderTree.mm:1821 
        | CFRunLoopRunSpecific 
        | __CFRunLoopRun 
        | __CFRunLoopDoTimer 
        | __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ 
        | WebCore::timerFired(__CFRunLoopTimer*, void*) SharedTimerMac.mm:134 
        | WebCore::ThreadTimers::sharedTimerFired() ThreadTimers.cpp:108 
        | WebCore::ThreadTimers::sharedTimerFiredInternal() ThreadTimers.cpp:135 
        | WebCore::Timer&lt;WebCore::GenericEventQueue&gt;::fired() Timer.h:133 
        | std::__1::function&lt;void ()&gt;::operator()() const functional:1435 
        | std::__1::__function::__func&lt;std::__1::__bind&lt;void (WebCore::GenericEventQueue::*)(WebCore::Timer&lt;WebCore::GenericEventQueue&gt;&amp;)&amp;, WebCore::GenericEventQueue*&amp;, std::__1::reference_wrapper&lt;WebCore::Timer&lt;WebCore::GenericEventQueue&gt; &gt; &gt;, std::__1::allocator&lt;std::__1::__bind&lt;void (WebCore::GenericEventQueue::*)(WebCore::Timer&lt;WebCore::GenericEventQueue&gt;&amp;)&amp;, WebCore::GenericEventQueue*&amp;, std::__1::reference_wrapper&lt;WebCore::Timer&lt;WebCore::GenericEventQueue&gt; &gt; &gt; &gt;, void ()&gt;::operator()() functional:1059 
        | WebCore::GenericEventQueue::timerFired(WebCore::Timer&lt;WebCore::GenericEventQueue&gt;&amp;) GenericEventQueue.cpp:72 
        | WebCore::Node::dispatchEvent(WTF::PassRefPtr&lt;WebCore::Event&gt;) Node.cpp:2028 
        | WebCore::EventDispatcher::dispatchEvent(WebCore::Node*, WTF::PassRefPtr&lt;WebCore::Event&gt;) EventDispatcher.cpp:326 
        | WebCore::dispatchEventInDOM(WebCore::Event&amp;, WebCore::EventPath const&amp;, WebCore::WindowEventContext&amp;) EventDispatcher.cpp:271 
        | WebCore::EventContext::handleLocalEvents(WebCore::Event&amp;) const EventContext.cpp:55 
        | WebCore::Node::handleLocalEvents(WebCore::Event&amp;) Node.cpp:2014 
        | WebCore::EventTarget::fireEventListeners(WebCore::Event*) EventTarget.cpp:197 
        | WebCore::EventTarget::fireEventListeners(WebCore::Event*, WebCore::EventTargetData*, WTF::Vector&lt;WebCore::RegisteredEventListener, 1ul, WTF::CrashOnOverflow&gt;&amp;) EventTarget.cpp:247 
        | WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) JSEventListener.cpp:126 
        | WebCore::JSMainThreadExecState::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&amp;, JSC::JSValue, JSC::ArgList const&amp;) JSMainThreadExecState.h:55 
        | JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&amp;, JSC::JSValue, JSC::ArgList const&amp;) CallData.cpp:39 
        | JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&amp;, JSC::JSValue, JSC::ArgList const&amp;) Interpreter.cpp:994 
        | JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) JITCode.cpp:47 
        | callToJavaScript 
        | llint_op_call 
        | llint_op_call 
        | llint_op_call 
        | llint_op_call 
        | 0x5d028c80103a 
        | WebCore::jsWebGLRenderingContextPrototypeFunctionTexImage2D(JSC::ExecState*) JSWebGLRenderingContext.cpp:3313 
        | WebCore::jsWebGLRenderingContextPrototypeFunctionTexImage2D5(JSC::ExecState*) JSWebGLRenderingContext.cpp:3295 
        | WebCore::WebGLRenderingContext::texImage2D(unsigned int, int, unsigned int, unsigned int, unsigned int, WebCore::HTMLVideoElement*, int&amp;) WebGLRenderingContext.cpp:3974 
        | WebCore::WebGLRenderingContext::videoFrameToImage(WebCore::HTMLVideoElement*, WebCore::BackingStoreCopy, int&amp;) WebGLRenderingContext.cpp:3945 
        | WebCore::HTMLVideoElement::paintCurrentFrameInContext(WebCore::GraphicsContext*, WebCore::IntRect const&amp;) HTMLVideoElement.cpp:256 
        | WebCore::MediaPlayer::setVisible(bool) MediaPlayer.cpp:738 
        | WebCore::MediaPlayerPrivateAVFoundation::setVisible(bool) MediaPlayerPrivateAVFoundation.cpp:593 
        | WebCore::MediaPlayerPrivateAVFoundation::setUpVideoRendering() MediaPlayerPrivateAVFoundation.cpp:139 
        | WebCore::MediaPlayerPrivateAVFoundationObjC::createContextVideoRenderer() MediaPlayerPrivateAVFoundationObjC.mm:434 
        | WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput() MediaPlayerPrivateAVFoundationObjC.mm:1424 
        | WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange() MediaPlayerPrivateAVFoundationObjC.mm:1569 
        | dispatch_semaphore_create 
        | _os_object_alloc 
        | class_createInstance 
        | calloc 
        | malloc_zone_calloc 

Looks like it is not released in the destructor.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>987624</commentid>
    <comment_count>1</comment_count>
      <attachid>225969</attachid>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2014-03-06 01:50:06 -0800</bug_when>
    <thetext>Created attachment 225969
[PATCH] Proposed Fix</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>987738</commentid>
    <comment_count>2</comment_count>
      <attachid>225969</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2014-03-06 09:59:39 -0800</bug_when>
    <thetext>Comment on attachment 225969
[PATCH] Proposed Fix

Clearing flags on attachment: 225969

Committed r165195: &lt;http://trac.webkit.org/changeset/165195&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>987739</commentid>
    <comment_count>3</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2014-03-06 09:59:41 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>225969</attachid>
            <date>2014-03-06 01:50:06 -0800</date>
            <delta_ts>2014-03-06 09:59:38 -0800</delta_ts>
            <desc>[PATCH] Proposed Fix</desc>
            <filename>semaphore-leak.patch</filename>
            <type>text/plain</type>
            <size>1533</size>
            <attacher name="Joseph Pecoraro">joepeck</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZyBiL1NvdXJjZS9XZWJDb3JlL0No
YW5nZUxvZwppbmRleCBiZGRkY2ZmLi4zMTYxYTVmIDEwMDY0NAotLS0gYS9Tb3VyY2UvV2ViQ29y
ZS9DaGFuZ2VMb2cKKysrIGIvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMTMg
QEAKKzIwMTQtMDMtMDYgIEpvc2VwaCBQZWNvcmFybyAgPHBlY29yYXJvQGFwcGxlLmNvbT4KKwor
ICAgICAgICBbTWFjXSBMZWFrOiBkaXNwYXRjaF9zZW1hcGhvcmUgbGVhayBhbGxvY2F0ZWQgaW4g
TWVkaWFQbGF5ZXJQcml2YXRlQVZGb3VuZGF0aW9uT2JqQzo6d2FpdEZvclZpZGVvT3V0cHV0TWVk
aWFEYXRhV2lsbENoY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