<?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>181274</bug_id>
          
          <creation_ts>2018-01-03 20:19:40 -0800</creation_ts>
          <short_desc>REGRESSION (r212929): WKSnapshotConfiguration may leak an NSNumber when deallocated</short_desc>
          <delta_ts>2018-01-04 12:29:30 -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>WebKit2</component>
          <version>Other</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>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>161450</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="David Kilzer (:ddkilzer)">ddkilzer</reporter>
          <assigned_to name="David Kilzer (:ddkilzer)">ddkilzer</assigned_to>
          <cc>ap</cc>
    
    <cc>commit-queue</cc>
    
    <cc>jbedard</cc>
    
    <cc>joepeck</cc>
    
    <cc>thorton</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1385669</commentid>
    <comment_count>0</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2018-01-03 20:19:40 -0800</bug_when>
    <thetext>Source/WebKit/UIProcess/API/Cocoa/WKSnapshotConfiguration.mm:31:1: warning: &apos;WKSnapshotConfiguration&apos; lacks a &apos;dealloc&apos; instance method but must release &apos;_snapshotWidth&apos;
@implementation WKSnapshotConfiguration
^
1 warning generated.

Regressed with:

Bug 161450: No reliable way to get a snapshot of WKWebView
&lt;https://bugs.webkit.org/show_bug.cgi?id=161450&gt;

Found by building WebKit project with clang static analyzer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1385680</commentid>
    <comment_count>1</comment_count>
      <attachid>330439</attachid>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2018-01-03 20:35:31 -0800</bug_when>
    <thetext>Created attachment 330439
Patch v1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1385687</commentid>
    <comment_count>2</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2018-01-03 20:39:22 -0800</bug_when>
    <thetext>If the NSNumber object isn&apos;t set, or if it&apos;s a tagged pointer, there&apos;s probably no leak in practice, but there isn&apos;t a guarantee that a tagged pointer will always be used.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1385692</commentid>
    <comment_count>3</comment_count>
      <attachid>330439</attachid>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2018-01-03 21:02:23 -0800</bug_when>
    <thetext>Comment on attachment 330439
Patch v1

r=me! Nice</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1385693</commentid>
    <comment_count>4</comment_count>
      <attachid>330439</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2018-01-03 21:23:58 -0800</bug_when>
    <thetext>Comment on attachment 330439
Patch v1

Clearing flags on attachment: 330439

Committed r226391: &lt;https://trac.webkit.org/changeset/226391&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1385694</commentid>
    <comment_count>5</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2018-01-03 21:23:59 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1385695</commentid>
    <comment_count>6</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2018-01-03 21:24:54 -0800</bug_when>
    <thetext>&lt;rdar://problem/36290876&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1385803</commentid>
    <comment_count>7</comment_count>
    <who name="Jonathan Bedard">jbedard</who>
    <bug_when>2018-01-04 07:43:15 -0800</bug_when>
    <thetext>Did our leak checker not identify this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1385837</commentid>
    <comment_count>8</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2018-01-04 09:41:36 -0800</bug_when>
    <thetext>(In reply to Jonathan Bedard from comment #7)
&gt; Did our leak checker not identify this?

This bug was not a leak, it was an over-released object, so the leak checker wouldn&apos;t have caught it.

Our internal static analysis bot would have caught it, but it&apos;s using a build of macOS prior to 10.13.2, so this particular code would not have been compiled or analyzed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1385846</commentid>
    <comment_count>9</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2018-01-04 10:39:35 -0800</bug_when>
    <thetext>(In reply to David Kilzer (:ddkilzer) from comment #8)
&gt; (In reply to Jonathan Bedard from comment #7)
&gt; &gt; Did our leak checker not identify this?
&gt; 
&gt; This bug was not a leak, it was an over-released object, so the leak checker
&gt; wouldn&apos;t have caught it.

Hmm, I think this was a leak and not an over-released object.

ddkilzer has been a strong proponent of having the static analyzer catch these kinds of issues, and I think the ability to &apos;detect leaks of strong/copy/retain properties not released in dealloc&apos; was added to the analyzer a couple years ago:
https://reviews.llvm.org/D17511</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1385869</commentid>
    <comment_count>10</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2018-01-04 11:49:40 -0800</bug_when>
    <thetext>(In reply to Joseph Pecoraro from comment #9)
&gt; (In reply to David Kilzer (:ddkilzer) from comment #8)
&gt; &gt; (In reply to Jonathan Bedard from comment #7)
&gt; &gt; &gt; Did our leak checker not identify this?
&gt; &gt; 
&gt; &gt; This bug was not a leak, it was an over-released object, so the leak checker
&gt; &gt; wouldn&apos;t have caught it.
&gt; 
&gt; Hmm, I think this was a leak and not an over-released object.
&gt; 
&gt; ddkilzer has been a strong proponent of having the static analyzer catch
&gt; these kinds of issues, and I think the ability to &apos;detect leaks of
&gt; strong/copy/retain properties not released in dealloc&apos; was added to the
&gt; analyzer a couple years ago:
&gt; https://reviews.llvm.org/D17511

Oops!  Sorry, I was thinking of a different bug (Bug 181272) that was an over-release.

This was a leak!

However, this leak may not have been caught by the leaks bot if this code path was not exercised in our (layout) tests, or if the NSNumber was a tagged pointer (I think).

As Joseph mentioned, though, the clang static analyzer should have caught this (assuming it runs the Objective-C dealloc checker).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1385883</commentid>
    <comment_count>11</comment_count>
    <who name="Jonathan Bedard">jbedard</who>
    <bug_when>2018-01-04 12:29:30 -0800</bug_when>
    <thetext>(In reply to David Kilzer (:ddkilzer) from comment #10)
&gt; ....
&gt; 
&gt; However, this leak may not have been caught by the leaks bot if this code
&gt; path was not exercised in our (layout) tests, or if the NSNumber was a
&gt; tagged pointer (I think).
&gt; 
&gt; As Joseph mentioned, though, the clang static analyzer should have caught
&gt; this (assuming it runs the Objective-C dealloc checker).


I have the answer to my own question.

We DO use this when running layout tests, added here: &lt;https://trac.webkit.org/changeset/216462/webkit&gt;.  But, this code path is only used when running WebKit2 tests (which we don&apos;t run leak checking on) and is only used when we have a real IOSURFACE, meaning on-device testing (which we also don&apos;t run leak checking on)</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>330439</attachid>
            <date>2018-01-03 20:35:31 -0800</date>
            <delta_ts>2018-01-03 21:23:58 -0800</delta_ts>
            <desc>Patch v1</desc>
            <filename>bug-181274-20180103203530.patch</filename>
            <type>text/plain</type>
            <size>1325</size>
            <attacher name="David Kilzer (:ddkilzer)">ddkil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