Skip to content

fix(zone.js): should invoke xhr send task when no response error occurs#38836

Closed
JiaLiPassion wants to merge 1 commit intoangular:masterfrom
JiaLiPassion:zone-xhr-error
Closed

fix(zone.js): should invoke xhr send task when no response error occurs#38836
JiaLiPassion wants to merge 1 commit intoangular:masterfrom
JiaLiPassion:zone-xhr-error

Conversation

@JiaLiPassion
Copy link
Contributor

Close #38795

in XMLHttpRequest patch, when get readystatechange event, zone.js try to
invoke load event listener first, then call invokeTask to finish the
XMLHttpRequest::send macroTask, but if the request failed because the
server can not be reached, the load event listener will not be invoked,
so the invokeTask of the XMLHttpRequest::send will not be triggered either,
so we will have a non finished macroTask there which will make the Zone
not stable, also memory leak.

So in this PR, if the XMLHttpRequest.status = 0 when we get the readystatechange
event, that means something wents wrong before we reached the server, we need to
invoke the task to finish the macroTask.

@JiaLiPassion JiaLiPassion added the area: zones Issues related to zone.js label Sep 14, 2020
@ngbot ngbot bot added this to the needsTriage milestone Sep 14, 2020
Close angular#38795

in the XMLHttpRequest patch, when get `readystatechange` event, zone.js try to
invoke `load` event listener first, then call `invokeTask` to finish the
`XMLHttpRequest::send` macroTask, but if the request failed because the
server can not be reached, the `load` event listener will not be invoked,
so the `invokeTask` of the `XMLHttpRequest::send` will not be triggered either,
so we will have a non finished macroTask there which will make the Zone
not stable, also memory leak.

So in this PR, if the `XMLHttpRequest.status = 0` when we get the `readystatechange`
event, that means something wents wrong before we reached the server, we need to
invoke the task to finish the macroTask.
@mhevery mhevery added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Sep 15, 2020
@mhevery
Copy link
Contributor

mhevery commented Sep 15, 2020

presubmit

@mhevery
Copy link
Contributor

mhevery commented Sep 18, 2020

presubmit (previous run failed with unrelated build breakage)

Copy link
Member

@JoostK JoostK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @JiaLiPassion for the fix! 🚀

@mhevery mhevery closed this in d92a0dd Sep 18, 2020
mhevery pushed a commit that referenced this pull request Sep 18, 2020
…rs (#38836)

Close #38795

in the XMLHttpRequest patch, when get `readystatechange` event, zone.js try to
invoke `load` event listener first, then call `invokeTask` to finish the
`XMLHttpRequest::send` macroTask, but if the request failed because the
server can not be reached, the `load` event listener will not be invoked,
so the `invokeTask` of the `XMLHttpRequest::send` will not be triggered either,
so we will have a non finished macroTask there which will make the Zone
not stable, also memory leak.

So in this PR, if the `XMLHttpRequest.status = 0` when we get the `readystatechange`
event, that means something wents wrong before we reached the server, we need to
invoke the task to finish the macroTask.

PR Close #38836
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: zones Issues related to zone.js cla: yes target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Macro Tasks left running after failed http requests with Unknown Error, preventing protractor from completing tests

4 participants