<?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>224523</bug_id>
          
          <creation_ts>2021-04-13 19:27:44 -0700</creation_ts>
          <short_desc>[WinCairo][curl] flaky http test failures due to the connection limit on 8 cores CPU</short_desc>
          <delta_ts>2021-04-15 20:55:01 -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>Platform</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</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="Fujii Hironori">fujii</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1749975</commentid>
    <comment_count>0</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2021-04-13 19:27:44 -0700</bug_when>
    <thetext>[WinCairo][curl] flaky http test failures under heavy CPU load

http tests are randomly failing for WinCairo WebKit1 and WebKit2.

This issue can be reproduced by the following command.

&gt; python.exe ./Tools/Scripts/run-webkit-tests --wincairo --release  --no-new-test-results --no-retry-failures http/tests/css/border-image-loading.html --iterations=10000 --exit-after-n-failures=20 -f --no-show-results

[11/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[11/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[12/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[15/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[15/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[27/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[31/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[32/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[32/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[32/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[39/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[44/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[52/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[57/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[58/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[60/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[61/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[65/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[67/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[69/10000] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
Exiting early after 20 failures. 54 tests run.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750033</commentid>
    <comment_count>1</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2021-04-14 00:42:58 -0700</bug_when>
    <thetext>Running a single DRT/WTR is stable, no flaky failures.

&gt; python.exe ./Tools/Scripts/run-webkit-tests --wincairo --release --no-retry-failures --iterations=10000 --exit-after-n-failures=20 --no-show-results http/tests/css/border-image-loading.html

However, running multiple curl commands in the background to stress the httpd makes the WTR fail.

&gt; seq 10000 | xargs -n 1 -P 16 curl -s http://127.0.0.1:8000/css/border-image-loading.html -o

In this case, all generated curl output files are exactly same. I think this is not an Apache bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750335</commentid>
    <comment_count>2</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2021-04-14 14:27:39 -0700</bug_when>
    <thetext>This issue can be reproduced with MiniBrowser.

1. Start MiniBrowser in a debugger
   devenv -debugexe .\WebKitBuild\Debug\bin64\MiniBrowser.exe --wk1 http://127.0.0.1:8000/css/border-image-loading.html
2. Put a bread point in the error case of CurlRequest::didCompleteTransfer
   https://github.com/WebKit/WebKit/blob/main/Source/WebCore/platform/network/curl/CurlRequest.cpp#L475
3. Invoke run-webkit-httpd as admin
4. Invoke multiple curl commands to stress the httpd
   yes http://127.0.0.1:8000/css/border-image-loading.html | xargs -n 1 -P 16 curl -s -O
5. Repeat clicking &apos;Reload&apos; button until the break point is hit

&apos;result&apos; was CURLE_COULDNT_CONNECT (0x00000007) in the case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750346</commentid>
    <comment_count>3</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2021-04-14 14:44:44 -0700</bug_when>
    <thetext>This issue?

CURLE_COULDNT_CONNECT during heavy workload: tens of thousands of requests per minute - Stack Overflow
https://stackoverflow.com/q/32212207


However, enabling CURLOPT_FORBID_REUSE seems no luck.

diff --git a/Source/WebCore/platform/network/curl/CurlContext.cpp b/Source/WebCore/platform/network/curl/CurlContext.cpp
index 2f6556ee05b1..a4df0b19b595 100644
--- a/Source/WebCore/platform/network/curl/CurlContext.cpp
+++ b/Source/WebCore/platform/network/curl/CurlContext.cpp
@@ -399,6 +399,8 @@ void CurlHandle::setUrl(const URL&amp; url)
     // url is in ASCII so latin1() will only convert it to char* without character translation.
     curl_easy_setopt(m_handle, CURLOPT_URL, curlUrl.string().latin1().data());
 
+    curl_easy_setopt(m_handle, CURLOPT_FORBID_REUSE, 1L);
+
     if (url.protocolIs(&quot;https&quot;))
         enableSSLForHost(m_url.host().toString());
 }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750424</commentid>
    <comment_count>4</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2021-04-14 17:18:57 -0700</bug_when>
    <thetext>I&apos;m using Intel Core i9 (8 cores, 16 threads).
This issue can be reproduced just by running 16 WTR instances for 16 iterarions simultaneously.

&gt; python.exe ./Tools/Scripts/run-webkit-tests --wincairo --release --no-retry-failures --iterations=16 --no-show-results http/tests/css/border-image-loading.html -f

Running 16 WebKitTestRunners in parallel.

[10/16] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[15/16] http/tests/css/border-image-loading.html failed unexpectedly (text diff)
[16/16] http/tests/css/border-image-loading.html failed unexpectedly (text diff)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750456</commentid>
    <comment_count>5</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2021-04-14 19:52:47 -0700</bug_when>
    <thetext>another test case that is flaky under the heavy load.

python.exe ./Tools/Scripts/run-webkit-tests --wincairo --release --no-retry-failures --iterations=10000 --exit-after-n-failures=20 -f http/tests/xmlhttprequest/send-data-view.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750487</commentid>
    <comment_count>6</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2021-04-14 22:39:16 -0700</bug_when>
    <thetext>Oops. http/tests/css/border-image-loading.html isn&apos;t a example of this issue. The test can&apos;t work in parallel loads.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750495</commentid>
    <comment_count>7</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2021-04-14 23:09:10 -0700</bug_when>
    <thetext>Other test cases reproducing this issue:

http/tests/xmlhttprequest/supported-xml-content-types.html
http/tests/xmlhttprequest/upload-onloadend-event-after-sync-requests.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750865</commentid>
    <comment_count>8</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2021-04-15 17:47:57 -0700</bug_when>
    <thetext>This issue can be reproduced with Windows curl.exe, curl on WSL1 and wget on WSL1.

1. Run 16 DRT instances in the background
 python.exe ./Tools/Scripts/run-webkit-tests --wincairo --release --no-retry-failures --iterations=30000 -1 -f http/tests/xmlhttprequest/send-data-view.html
2. Invoke Windows curl.exe repeatedly
 1..1000 |% { curl.exe -O http://127.0.0.1:8000/xmlhttprequest/send-data-view.html }

Connections intermittently failed.

&gt;   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
&gt;                                  Dload  Upload   Total   Spent    Left  Speed
&gt;   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to 127.0.0.1 port 8000: Address already in use
&gt;   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
&gt;                                  Dload  Upload   Total   Spent    Left  Speed
&gt;   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to 127.0.0.1 port 8000: Address already in use
&gt;   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
&gt;                                  Dload  Upload   Total   Spent    Left  Speed
&gt; 100   630  100   630    0     0    630      0  0:00:01 --:--:--  0:00:01 10161
&gt;   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
&gt;                                  Dload  Upload   Total   Spent    Left  Speed
&gt;   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to 127.0.0.1 port 8000: Address already in use
&gt;   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
&gt;                                  Dload  Upload   Total   Spent    Left  Speed
&gt; 100   630  100   630    0     0    630      0  0:00:01 --:--:--  0:00:01  6702

I observed the intermittent connection failures with curl and wget on WSL1. 

repeat 1000 curl http://127.0.0.1:8000/xmlhttprequest/send-data-view.html

&gt; curl: (7) Failed to connect to 127.0.0.1 port 8000: Connection refused

repeat 1000 wget http://127.0.0.1:8000/xmlhttprequest/send-data-view.html

&gt; Connecting to 127.0.0.1:8000... failed: Address already in use.

WinCairo MiniBrowser also reproduced the connection failures by repeatedly reloading http://127.0.0.1:8000/xmlhttprequest/send-data-view.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750915</commentid>
    <comment_count>9</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2021-04-15 20:54:54 -0700</bug_when>
    <thetext>Increasing user port range solves this issue.

&gt; netsh int ipv4 set dynamicport tcp start=1025 num=64511

Settings that can be Modified to Improve Network Performance - BizTalk Server | Microsoft Docs
https://docs.microsoft.com/en-us/biztalk/technical-guides/settings-that-can-be-modified-to-improve-network-performance</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>