Bug 226454 - XMLHttpRequest Safari Networking Process Growing Memory Usage and Crash with Internal Error
Summary: XMLHttpRequest Safari Networking Process Growing Memory Usage and Crash with ...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: https://openspeedtest.com
Keywords: HTML5, InRadar
Depends on:
Blocks:
 
Reported: 2021-05-30 23:50 PDT by OpenSpeedTest.com
Modified: 2021-07-12 18:23 PDT (History)
7 users (show)

See Also:


Attachments
Screenshot at 121 seconds of running the script (274.79 KB, image/png)
2021-05-30 23:58 PDT, OpenSpeedTest.com
no flags Details
100Gb Memory usage ss after 277 seconds (643.35 KB, image/png)
2021-05-31 00:01 PDT, OpenSpeedTest.com
no flags Details
Requests error after 350 seconds Network process exited after 110+Gb of memory usage (1.19 MB, image/png)
2021-05-31 00:02 PDT, OpenSpeedTest.com
no flags Details
Safari Private Window vs Normal Window Performance Difference. (6.88 MB, video/mp4)
2021-05-31 00:12 PDT, OpenSpeedTest.com
no flags Details
Fetch and XHR implementation, Run it on M1 MacMini 10GbE or any Client and Server with 10GbE (33.85 KB, application/zip)
2021-06-30 21:07 PDT, OpenSpeedTest.com
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description OpenSpeedTest.com 2021-05-30 23:50:13 PDT
I am debugging OpenSpeedTest an Ajax based network performance estimation tool. 

Which is maxing Multiple XHR requests to the server to benchmark user connection speed. 

I noticed HUGE memory Leake in Safari and i saw growing memory up to 100+Gb in Safari Networking Process after some time the repeated XHR requested retuned an error and stopped. 

I also noticed if we give 100Ms time before making new request Networking Process Growing Memory get resolved. 

Another most important issue i found is Performance difference in Normal Windows vs Private window without installing any Extensions the difference is huge.

In Private window the Networking Process Growing Memory issue is not there. 

I tested this on Intel Mac and M1 Mac. Latest Stable and technology preview Safari. 


Why Networking Process Growing Memory if we make a new request every-time?


Why Huge Performance difference in Private mode vs Normal windows?
Comment 1 OpenSpeedTest.com 2021-05-30 23:58:35 PDT
Created attachment 430176 [details]
Screenshot at 121 seconds of running the script

Screenshot at 121 seconds of running the script
Comment 2 OpenSpeedTest.com 2021-05-31 00:01:30 PDT
Created attachment 430177 [details]
100Gb Memory usage ss after 277 seconds

100Gb Memory usage screen after 277 seconds
Comment 3 OpenSpeedTest.com 2021-05-31 00:02:50 PDT
Created attachment 430178 [details]
Requests error after 350 seconds Network process exited after 110+Gb of memory usage

Requests error after 350 seconds Network process exited after 110+Gb of memory usage
Comment 4 OpenSpeedTest.com 2021-05-31 00:12:15 PDT
Created attachment 430180 [details]
Safari Private Window vs Normal Window Performance Difference.

Safari Private Window vs Normal Window Performance Difference.
In this video i am showing private windows on the right and normal windows on the left. 

The first running number is the speed in Mbps that is 4000Mbps.

As you can see from the video Private windows is Always 20% Faster than Normal Windows. Consistently getting 1000Mbps more on the private window.

Why is that?

I have not installed any extensions.
Comment 5 Chris Dumez 2021-06-01 18:14:54 PDT
Maybe HTTP disk cache-related if it doesn't happen in private browsing?
Comment 6 Chris Dumez 2021-06-02 08:51:37 PDT
I am having trouble reproducing on openspeedtest.com. I see some memory growth but not in the GBs.
Comment 7 OpenSpeedTest.com 2021-06-02 10:09:01 PDT
Steps to reproduce the problem:
1.Install OpenSpeedTest Docker
2.Make sure you have 10GbE Networking 
3.Run the test to see the Massive Memory Growth.

You can change the download and upload test run time inside the docker image index.html file. currently it's 12 seconds. if you are using a 10GbE network you can quickly see the growth. 

I have written a script that run continuously  and crash itself after 350 seconds.

i can share it here if you like to test. 

thanks
Comment 8 Radar WebKit Bug Importer 2021-06-06 23:51:18 PDT
<rdar://problem/78936212>
Comment 9 Alex Christensen 2021-06-21 12:24:15 PDT
Sharing that script here would be quite helpful.
Comment 10 OpenSpeedTest.com 2021-06-30 21:07:40 PDT
Created attachment 432656 [details]
Fetch and XHR implementation, Run it on M1 MacMini 10GbE or any Client and Server with 10GbE

Fetch and XHR implementation, Run it on M1 MacMini 10GbE or any Client and Server with 10GbE.

Up to 1 Gbps you many not see Memory issues and perf. diff. between Normal window and Private window. So use 10GbE networking on both client and server.
Comment 11 OpenSpeedTest.com 2021-06-30 21:37:15 PDT
Make sure, you disable Gzip from Server Side.
Comment 12 OpenSpeedTest.com 2021-07-04 21:44:21 PDT
xhr.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0");

Resolved this memory leak. And Now Everything working fine.
Comment 13 OpenSpeedTest.com 2021-07-12 18:23:46 PDT
Updated docker image with Server side cache header https://hub.docker.com/r/openspeedtest/latest How can i close this bug report? 
In my test safari is the fastest browser. 
Thank you!