<?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>175872</bug_id>
          
          <creation_ts>2017-08-22 21:07:07 -0700</creation_ts>
          <short_desc>REGRESSION (r221059): NetworkDataTask::didReceiveResponse() should not use PolicyUse for HTTP/0.9</short_desc>
          <delta_ts>2017-08-23 10:15:15 -0700</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>WebKit Nightly Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar, Regression</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>175832</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Chris Dumez">cdumez</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>achristensen</cc>
    
    <cc>ap</cc>
    
    <cc>commit-queue</cc>
    
    <cc>dbates</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1341444</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-08-22 21:07:07 -0700</bug_when>
    <thetext>NetworkDataTask::didReceiveResponse() should not use PolicyUse for HTTP/0.9.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341445</commentid>
    <comment_count>1</comment_count>
      <attachid>318850</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-08-22 21:08:20 -0700</bug_when>
    <thetext>Created attachment 318850
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341457</commentid>
    <comment_count>2</comment_count>
      <attachid>318850</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2017-08-22 22:32:46 -0700</bug_when>
    <thetext>Comment on attachment 318850
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=318850&amp;action=review

&gt; Source/WebKit/ChangeLog:3
&gt; +        Regression(r221059): NetworkDataTask::didReceiveResponse() should not use PolicyUse for HTTP/0.9

Can this be tested?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341458</commentid>
    <comment_count>3</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-08-22 22:41:27 -0700</bug_when>
    <thetext>(In reply to Alexey Proskuryakov from comment #2)
&gt; Comment on attachment 318850 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=318850&amp;action=review
&gt; 
&gt; &gt; Source/WebKit/ChangeLog:3
&gt; &gt; +        Regression(r221059): NetworkDataTask::didReceiveResponse() should not use PolicyUse for HTTP/0.9
&gt; 
&gt; Can this be tested?

I will look into more detail tomorrow but I doubt it since we cancel right after the completion handler call. The completion handler is mostly so that CFNetwork does not leak stuff. There are 4 tests exercising this code path, all of which are still passing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341459</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-08-22 22:47:14 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #3)
&gt; (In reply to Alexey Proskuryakov from comment #2)
&gt; &gt; Comment on attachment 318850 [details]
&gt; &gt; Patch
&gt; &gt; 
&gt; &gt; View in context:
&gt; &gt; https://bugs.webkit.org/attachment.cgi?id=318850&amp;action=review
&gt; &gt; 
&gt; &gt; &gt; Source/WebKit/ChangeLog:3
&gt; &gt; &gt; +        Regression(r221059): NetworkDataTask::didReceiveResponse() should not use PolicyUse for HTTP/0.9
&gt; &gt; 
&gt; &gt; Can this be tested?
&gt; 
&gt; I will look into more detail tomorrow but I doubt it since we cancel right
&gt; after the completion handler call. The completion handler is mostly so that
&gt; CFNetwork does not leak stuff. There are 4 tests exercising this code path,
&gt; all of which are still passing.

To be clear, I do not believe this effectively changes anything from WebKit point of view. However, it feels cleaner to use ignore policy here and it may avoid some unnecessary work at CFNetwork level.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341476</commentid>
    <comment_count>5</comment_count>
      <attachid>318850</attachid>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-08-23 01:06:12 -0700</bug_when>
    <thetext>Comment on attachment 318850
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=318850&amp;action=review

&gt; Source/WebKit/ChangeLog:8
&gt; +        Use PolicyIgnore instead.

Please explain why.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341552</commentid>
    <comment_count>6</comment_count>
      <attachid>318875</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-08-23 09:04:09 -0700</bug_when>
    <thetext>Created attachment 318875
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341567</commentid>
    <comment_count>7</comment_count>
      <attachid>318875</attachid>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-08-23 09:39:41 -0700</bug_when>
    <thetext>Comment on attachment 318875
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=318875&amp;action=review

OK.

&gt; Source/WebKit/NetworkProcess/NetworkDataTask.cpp:106
&gt; -            completionHandler({ });
&gt; +            completionHandler(PolicyIgnore);

Notice that PolicyIgnore is translated to NSURLSessionResponseCancel. I would have hoped that NSURLSession and URLSession:dataTask:didReceiveResponse:completionHandler: would have been coded such that calling -[NSURLSessionDataTask cancel] (what cancel() does for the non-Blob case) would be equivalent to invoking the completion handler with NSURLSessionResponseCancel and hence not necessitate explicitly calling the completion handler. Is it necessary to also call cancel()? is it good practice?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341568</commentid>
    <comment_count>8</comment_count>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-08-23 09:41:14 -0700</bug_when>
    <thetext>Out of curiosity, did you see a leak or bad behavior because we were not calling the completion handler in NetworkDataTask::didReceiveResponse()?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341570</commentid>
    <comment_count>9</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-08-23 09:45:28 -0700</bug_when>
    <thetext>(In reply to Daniel Bates from comment #8)
&gt; Out of curiosity, did you see a leak or bad behavior because we were not
&gt; calling the completion handler in NetworkDataTask::didReceiveResponse()?

I have not measured a leak for this particular handler. 

However, we have been caught by this several times before with other networking completion handlers. For e.g. Bug 175179 which was a bad leak case. We&apos;ve also had cases of network hangs due to us not calling the completion handlers (supposedly because of leaking open connections and reaching a limit for open connections).

Because this has happened several times and because the issues are hard to diagnose, we have introduced this new CompletionHandler type that helps catch such bugs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341571</commentid>
    <comment_count>10</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-08-23 09:46:31 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #9)
&gt; (In reply to Daniel Bates from comment #8)
&gt; &gt; Out of curiosity, did you see a leak or bad behavior because we were not
&gt; &gt; calling the completion handler in NetworkDataTask::didReceiveResponse()?
&gt; 
&gt; I have not measured a leak for this particular handler. 
&gt; 
&gt; However, we have been caught by this several times before with other
&gt; networking completion handlers. For e.g. Bug 175179 which was a bad leak
&gt; case. We&apos;ve also had cases of network hangs due to us not calling the
&gt; completion handlers (supposedly because of leaking open connections and
&gt; reaching a limit for open connections).
&gt; 
&gt; Because this has happened several times and because the issues are hard to
&gt; diagnose, we have introduced this new CompletionHandler type that helps
&gt; catch such bugs.

Forgot to mention, that 4 tests crash in debug builds now that we use CompletionHandler if we fail to call completion handler here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341584</commentid>
    <comment_count>11</comment_count>
      <attachid>318875</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2017-08-23 10:14:12 -0700</bug_when>
    <thetext>Comment on attachment 318875
Patch

Clearing flags on attachment: 318875

Committed r221081: &lt;http://trac.webkit.org/changeset/221081&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341585</commentid>
    <comment_count>12</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2017-08-23 10:14:14 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341586</commentid>
    <comment_count>13</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2017-08-23 10:15:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/34037374&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>318850</attachid>
            <date>2017-08-22 21:08:20 -0700</date>
            <delta_ts>2017-08-23 09:04:07 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-175872-20170822210819.patch</filename>
            <type>text/plain</type>
            <size>1700</size>
            <attacher name="Chris Dumez">cdumez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjIxMDY1CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViS2l0L0No
YW5nZUxvZyBiL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nCmluZGV4IDIzMzhjNTgxYTI1YTY3N2Mx
YWI3ZTNlY2VhZjYwMGNmNjg4YmFiMzEuLjg5ZjlhYTJkMGQyZWEyNTg2YTI0NDk1N2U0OGExNTM1
NDQ5YjBmNGEgMTAwNjQ0Ci0tLSBhL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nCisrKyBiL1NvdXJj
ZS9XZWJLaXQvQ2hhbmdlTG9nCkBAIC0xLDMgKzEs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29ya1Byb2Nlc3MvTmV0d29ya0RhdGFUYXNrLmNwcAor
KysgYi9Tb3VyY2UvV2ViS2l0L05ldHdvcmtQcm9jZXNzL05ldHdvcmtEYXRhVGFzay5jcHAKQEAg
LTEwMyw3ICsxMDMsNyBAQCB2b2lkIE5ldHdvcmtEYXRhVGFzazo6ZGlkUmVjZWl2ZVJlc3BvbnNl
KFJlc291cmNlUmVzcG9uc2UmJiByZXNwb25zZSwgUmVzcG9uc2VDbwogICAgICAgICBhdXRvIHVy
bCA9IHJlc3BvbnNlLnVybCgpOwogICAgICAgICBzdGQ6Om9wdGlvbmFsPHVpbnQxNl90PiBwb3J0
ID0gdXJsLnBvcnQoKTsKICAgICAgICAgaWYgKHBvcnQgJiYgIWlzRGVmYXVsdFBvcnRGb3JQcm90
b2NvbChwb3J0LnZhbHVlKCksIHVybC5wcm90b2NvbCgpKSkgewotICAgICAgICAgICAgY29tcGxl
dGlvbkhhbmRsZXIoeyB9KTsKKyAgICAgICAgICAgIGNvbXBsZXRpb25IYW5kbGVyKFBvbGljeUln
bm9yZSk7CiAgICAgICAgICAgICBjYW5jZWwoKTsKICAgICAgICAgICAgIG1fY2xpZW50LT5kaWRD
b21wbGV0ZVdpdGhFcnJvcih7IFN0cmluZygpLCAwLCB1cmwsICJDYW5jZWxsZWQgbG9hZCBmcm9t
ICciICsgdXJsLnN0cmluZ0NlbnRlckVsbGlwc2l6ZWRUb0xlbmd0aCgpICsgIicgYmVjYXVzZSBp
dCBpcyB1c2luZyBIVFRQLzAuOS4iIH0pOwogICAgICAgICAgICAgcmV0dXJuOwo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>318875</attachid>
            <date>2017-08-23 09:04:09 -0700</date>
            <delta_ts>2017-08-23 10:14:12 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-175872-20170823090408.patch</filename>
            <type>text/plain</type>
            <size>2098</size>
            <attacher name="Chris Dumez">cdumez</attacher>
            
              <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