Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop cloning response text on every chunk in XHR #23033

Merged
merged 2 commits into from Mar 14, 2019

Conversation

Projects
None yet
6 participants
@Manishearth
Copy link
Member

Manishearth commented Mar 13, 2019

r? @jdm


This change is Reviewable

@highfive

This comment has been minimized.

Copy link

highfive commented Mar 13, 2019

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/xmlhttprequest.rs
  • @KiChjang: components/script/dom/xmlhttprequest.rs
@highfive

This comment has been minimized.

Copy link

highfive commented Mar 13, 2019

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!

@Manishearth Manishearth force-pushed the Manishearth:xhr-copies branch from 966073e to e9d596d Mar 13, 2019

@jdm

This comment has been minimized.

Copy link
Member

jdm commented Mar 13, 2019

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Mar 13, 2019

📌 Commit e9d596d has been approved by jdm

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Mar 13, 2019

⌛️ Testing commit e9d596d with merge e34e023...

bors-servo added a commit that referenced this pull request Mar 13, 2019

Auto merge of #23033 - Manishearth:xhr-copies, r=jdm
Stop cloning response text on every chunk in XHR

r? @jdm

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23033)
<!-- Reviewable:end -->
let mut response = self.response.borrow_mut();
response.clear();
if let Some(len) = len {
response.reserve(len.0 as usize);

This comment has been minimized.

Copy link
@emilio

emilio Mar 13, 2019

Member

This should probably have a cap or at least be fallible, otherwise I can make a server auto-DOS Servo by sending a large content length.

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Mar 13, 2019

💔 Test failed - linux-rel-css

@Manishearth Manishearth force-pushed the Manishearth:xhr-copies branch from e9d596d to 89ca10d Mar 13, 2019

@Manishearth

This comment has been minimized.

Copy link
Member Author

Manishearth commented Mar 13, 2019

@bors-servo r=jdm,emilio

(emilio approves the 4MB magic number)

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Mar 13, 2019

📌 Commit 89ca10d has been approved by jdm,emilio

bors-servo added a commit that referenced this pull request Mar 13, 2019

Auto merge of #23033 - Manishearth:xhr-copies, r=jdm,emilio
Stop cloning response text on every chunk in XHR

r? @jdm

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23033)
<!-- Reviewable:end -->
@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Mar 13, 2019

⌛️ Testing commit 89ca10d with merge 87513cd...

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Mar 14, 2019

💔 Test failed - linux-rel-wpt

@CYBAI

This comment has been minimized.

Copy link
Collaborator

CYBAI commented Mar 14, 2019

  ▶ CRASH [expected OK] /xhr/abort-during-headers-received.htm
  │ 
  │ VMware, Inc.
  │ softpipe
  │ 3.3 (Core Profile) Mesa 18.3.0-devel
  │ DomRefCell<T> already mutably borrowed: BorrowError (thread ScriptThread PipelineId { namespace_id: PipelineNamespaceId(1), index: PipelineIndex(1) }, at src/libcore/result.rs:997)
  │ 2019-03-13 20:42:23.952 servo[29495:878139376] Metadata.framework [Error]: couldn't get the client port
  │ stack backtrace:
  │    0:        0x10695012e - __ZN9backtrace9backtrace5trace17h187a9f449e70183fE
  │    1:        0x10694f0bc - __ZN72_$LT$backtrace..capture..Backtrace$u20$as$u20$core..default..Default$GT$7default17hb88027beec82fd38E
  │    2:        0x1047519e9 - __ZN5servo4main28_$u7b$$u7b$closure$u7d$$u7d$17h8d7b55a85700f4fdE
  │    3:        0x1073dc1c0 - __ZN3std9panicking20rust_panic_with_hook17hc96a2ab9717cf47bE
  │    4:        0x1073dbc0c - __ZN3std9panicking18continue_panic_fmt17h829e4b1e6e9a8f39E
  │    5:        0x1073dbaf8 - _rust_begin_unwind
  │    6:        0x1073f97c1 - __ZN4core9panicking9panic_fmt17heb4299280251fdc5E
  │    7:        0x1054a7ac0 - __ZN4core6result13unwrap_failed17h2663b0acae44eae5E
  │    8:        0x1057a5615 - __ZN6script3dom14xmlhttprequest14XMLHttpRequest32dispatch_response_progress_event17h7adc01a19016e67eE
  │    9:        0x1057a462b - __ZN6script3dom14xmlhttprequest14XMLHttpRequest24process_partial_response17h706036830685db3aE.llvm.17036101771458632604
  │   10:        0x1057a092e - __ZN173_$LT$script..dom..xmlhttprequest..XMLHttpRequest$u20$as$u20$script..dom..bindings..codegen..Bindings..XMLHttpRequestBinding..XMLHttpRequestBinding..XMLHttpRequestMethods$GT$5Abort17ha6f58021c7267ac4E
  │   11:        0x104c292cb - __ZN3std9panicking3try7do_call17ha5f75f72fe79aa74E.llvm.3668353672499183747
  │   12:        0x1073e542e - ___rust_maybe_catch_panic
  │   13:        0x1052fd9b3 - __ZN6script3dom8bindings7codegen8Bindings21XMLHttpRequestBinding21XMLHttpRequestBinding5abort17h4bc3515e60974b85E
  │   14:        0x106a02c98 - _CallJitMethodOp
  │   15:        0x10569e981 - __ZN6script3dom8bindings5utils12generic_call17h8e297c081a4edbaaE
  │   16:        0x10569eb01 - __ZN6script3dom8bindings5utils14generic_method17he7907a8c26bfa0bfE
  │   17:        0x106a70615 - __ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructE
  │   18:        0x106a6a43c - __ZL9InterpretP9JSContextRN2js8RunStateE
  │   19:        0x106a60e97 - __ZN2js9RunScriptEP9JSContextRNS_8RunStateE
  │   20:        0x106a707e1 - __ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructE
  │   21:        0x106a70985 - __ZN2js4CallEP9JSContextN2JS6HandleINS2_5ValueEEES5_RKNS_13AnyInvokeArgsENS2_13MutableHandleIS4_EE
  │   22:        0x106e6d479 - __ZN2js9fun_applyEP9JSContextjPN2JS5ValueE
  │   23:        0x106a70615 - __ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructE
  │   24:        0x106a6a43c - __ZL9InterpretP9JSContextRN2js8RunStateE
  │   25:        0x106a60e97 - __ZN2js9RunScriptEP9JSContextRNS_8RunStateE
  │   26:        0x106a707e1 - __ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructE
  │   27:        0x106a70985 - __ZN2js4CallEP9JSContextN2JS6HandleINS2_5ValueEEES5_RKNS_13AnyInvokeArgsENS2_13MutableHandleIS4_EE
  │   28:        0x106e6d479 - __ZN2js9fun_applyEP9JSContextjPN2JS5ValueE
  │   29:        0x106a70615 - __ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructE
  │   30:        0x106a6a43c - __ZL9InterpretP9JSContextRN2js8RunStateE
  │   31:        0x106a60e97 - __ZN2js9RunScriptEP9JSContextRNS_8RunStateE
  │   32:        0x106a707e1 - __ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructE
  │   33:        0x106a70985 - __ZN2js4CallEP9JSContextN2JS6HandleINS2_5ValueEEES5_RKNS_13AnyInvokeArgsENS2_13MutableHandleIS4_EE
  │   34:        0x106dc1c8e - __Z20JS_CallFunctionValueP9JSContextN2JS6HandleIP8JSObjectEENS2_INS1_5ValueEEERKNS1_16HandleValueArrayENS1_13MutableHandleIS6_EE
  │   35:        0x1056d706a - __ZN6script3dom8bindings7codegen8Bindings19EventHandlerBinding19EventHandlerNonNull4Call17hc3261720994633f2E
  │   36:        0x1056d6d8f - __ZN6script3dom8bindings7codegen8Bindings19EventHandlerBinding19EventHandlerNonNull5Call_17h40eca2930f7da3e3E
  │   37:        0x104d80c6e - __ZN6script3dom11eventtarget21CompiledEventListener20call_or_handle_event17h93d379250ae81706E
  │   38:        0x1055c0b95 - __ZN6script3dom5event6invoke17he23f9ce4ba1c77f2E
  │   39:        0x1055c0067 - __ZN6script3dom5event5Event8dispatch17h7095b6351f4b1150E
  │   40:        0x1057a3c72 - __ZN6script3dom14xmlhttprequest14XMLHttpRequest18change_ready_state17h8bf724b30f90f061E
  │   41:        0x1057a4a2e - __ZN6script3dom14xmlhttprequest14XMLHttpRequest24process_partial_response17h706036830685db3aE.llvm.17036101771458632604
  │   42:        0x105799da1 - __ZN6script3dom14xmlhttprequest14XMLHttpRequest18initiate_async_xhr103_$LT$impl$u20$net_traits..FetchResponseListener$u20$for$u20$script..dom..xmlhttprequest..XHRContext$GT$16process_response17hd2bf33308cb189a9E
  │   43:        0x105696258 - __ZN76_$LT$net_traits..FetchResponseMsg$u20$as$u20$net_traits..Action$LT$T$GT$$GT$7process17he8b45a431ac07958E
  │   44:        0x105414b9e - __ZN106_$LT$script..network_listener..ListenerTask$LT$A$C$$u20$Listener$GT$$u20$as$u20$script..task..TaskOnce$GT$8run_once17hedecc394873fd770E
  │   45:        0x104d3ecee - __ZN43_$LT$T$u20$as$u20$script..task..TaskBox$GT$7run_box17h75332b480e0d2dc5E
  │   46:        0x1052bd9f1 - __ZN6script13script_thread12ScriptThread22handle_msg_from_script17hc8c53d815a0151f9E
  │   47:        0x1052b26b7 - __ZN6script13script_thread12ScriptThread11handle_msgs17hd7d610b48014b1e6E.llvm.13737532972690317428
  │   48:        0x1054754a7 - __ZN14profile_traits3mem12ProfilerChan25run_with_memory_reporting17h62de611e830750c8E
  │   49:        0x1051dcc30 - __ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17hf96de9ded5a9bff5E
  │   50:        0x104c2df2a - __ZN3std9panicking3try7do_call17hb33c5ebad2a6bc84E.llvm.3668353672499183747
  │   51:        0x1073e542e - ___rust_maybe_catch_panic
  │   52:        0x1054ac376 - __ZN50_$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$8call_box17hdd313ec26f4e94c5E
  │   53:        0x1073e487b - __ZN3std3sys4unix6thread6Thread3new12thread_start17hb65474f74178fcb3E
  │   54:     0x7fff921f499c - __pthread_body
  │   55:     0x7fff921f4919 - __pthread_start
  │ [2019-03-14T00:42:24Z ERROR servo] DomRefCell<T> already mutably borrowed: BorrowError
  └ Pipeline failed in hard-fail mode.  Crashing!
@@ -1077,18 +1074,32 @@ impl XMLHttpRequest {
headers
.as_ref()
.map(|h| *self.response_headers.borrow_mut() = h.clone());

let len = headers.and_then(|h| h.typed_get::<ContentLength>());
let mut response = self.response.borrow_mut();

This comment has been minimized.

Copy link
@jdm

jdm Mar 14, 2019

Member

I suspect this borrow is being aggravated by the change_ready_state.

@Manishearth Manishearth force-pushed the Manishearth:xhr-copies branch from 89ca10d to 79a5659 Mar 14, 2019

@Manishearth

This comment has been minimized.

Copy link
Member Author

Manishearth commented Mar 14, 2019

@bors-servo r=jdm,emilio

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Mar 14, 2019

📌 Commit 79a5659 has been approved by jdm,emilio

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Mar 14, 2019

⌛️ Testing commit 79a5659 with merge 7f85ff4...

bors-servo added a commit that referenced this pull request Mar 14, 2019

Auto merge of #23033 - Manishearth:xhr-copies, r=jdm,emilio
Stop cloning response text on every chunk in XHR

r? @jdm

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23033)
<!-- Reviewable:end -->
@Manishearth

This comment has been minimized.

Copy link
Member Author

Manishearth commented Mar 14, 2019

Scoped the borrow better

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Mar 14, 2019

💔 Test failed - linux-rel-css

@jdm

This comment has been minimized.

Copy link
Member

jdm commented Mar 14, 2019

@bors-servo retry

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Mar 14, 2019

💣 Failed to start rebuilding: Unknown error

bors-servo added a commit that referenced this pull request Mar 14, 2019

Auto merge of #23033 - Manishearth:xhr-copies, r=jdm,emilio
Stop cloning response text on every chunk in XHR

r? @jdm

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23033)
<!-- Reviewable:end -->
@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Mar 14, 2019

⌛️ Testing commit 79a5659 with merge 2cd454f...

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Mar 14, 2019

💔 Test failed - mac-rel-wpt2

@Manishearth

This comment has been minimized.

Copy link
Member Author

Manishearth commented Mar 14, 2019

@bors-servo retry

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Mar 14, 2019

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Mar 14, 2019

@bors-servo bors-servo merged commit 79a5659 into servo:master Mar 14, 2019

3 checks passed

Taskcluster (pull_request) TaskGroup: success
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
homu Test successful
Details

@Manishearth Manishearth deleted the Manishearth:xhr-copies branch Mar 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.