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

Crash once a http request ist send in Angular #167

Closed
florianfelgentraeger opened this issue Jan 27, 2020 · 16 comments
Closed

Crash once a http request ist send in Angular #167

florianfelgentraeger opened this issue Jan 27, 2020 · 16 comments

Comments

@florianfelgentraeger
Copy link

I've been trying to get it to run in Angular and the events are coming but once its recording and im sending a web request Chrome just crashes the request never finishes and i cant do anything anymore.
Any suggestions?

@Yuyz0112
Copy link
Member

Could you provide the code to reproduce this issus?

@florianfelgentraeger
Copy link
Author

Sadly no. I cant provide my code because its not a public project.
So far i tried it via a button in my navigation as well as in the app.component.ts (so once my Application starts up I start recording). Once a request occurs it Crashes. Cpu usage goes up to absurd levels and I can only close the window via task manager.

@24601
Copy link

24601 commented Jun 23, 2020

I am also experiencing this, Angular 9.

Totally locks Chrome tab.

@24601
Copy link

24601 commented Jun 23, 2020

I've been trying to get it to run in Angular and the events are coming but once its recording and im sending a web request Chrome just crashes the request never finishes and i cant do anything anymore.
Any suggestions?

Are you using the npm module install or script?

@Yuyz0112
Copy link
Member

@24601 Do you have a reproducible code for this?

@24601
Copy link

24601 commented Jun 23, 2020 via email

@kubadospial
Copy link

have the same issue with record function. Implementation:
image

result:
tab crashes
image

@Yuyz0112
Copy link
Member

@kubadospial Do you have any reproducible code for me to debug?

@kubadospial
Copy link

kubadospial commented Jul 30, 2020

unfortunately I tried to reproduce the issue on new, clear angular 9 project and I wasn't able to. If I figure out what was the issue in my company project, I will follow up with it.

@Yuyz0112
Copy link
Member

@kubadospial I remember someone has reported they are having this issue with a tooltip component, are you using something like that in your project too?

@kubadospial
Copy link

@Yuyz0112 yes we use a tooltip component in the app. In the free time I will remove this component and test if it helps. I will let you know

Yuyz0112 added a commit that referenced this issue Aug 16, 2020
This issue was originally reported in #280 but may also relate
to #167 and other potential performance issues in the recording.

In #206 I implemented the new mutation observer which will defer
the serialization of DOM, which helps us to have a consistent DOM
order for the replay.

In this implementation, we use an array to represent the `addQueue`.
Whenever we need to consume the queue, we will iterate it to make
sure there is no dead loop, and then shift the first item to see
whether it can be serialized at the new timing.

But this implementation may be very slow when there are a lot of newly
added DOM since it will do an O(n^2) iteration.

For example, if we have three newly added DOM `n1`, `n2`, `n3`,
the iteration looks like this:
```
[n1, n2, n3]
	n1 -> n2 -> n3, consume n3
[n1, n2]
	n1 -> n2, consume n2
[n1]
	n1, consume n1
```
We should have a better performance if te iteration looks like this:
```
[n1, n2, n3]
	n3, consume n3
[n1, n2]
	n2, consume n2
[n1]
	n1, consume n1
```

Simply reverse the mutation payload does not work, because it does
not always as same as the DOM order.

So in this patch, we replace the `addQueue` with a double linked list,
which can:
1. represent the DOM order in its data structure
2. has an O(1) time complexity when looking up the sibling of a list item
3. has an O(1) time complexity when removing a list item
Yuyz0112 added a commit that referenced this issue Aug 16, 2020
This issue was originally reported in #280 but may also relate
to #167 and other potential performance issues in the recording.

In #206 I implemented the new mutation observer which will defer
the serialization of DOM, which helps us to have a consistent DOM
order for the replay.

In this implementation, we use an array to represent the `addQueue`.
Whenever we need to consume the queue, we will iterate it to make
sure there is no dead loop, and then shift the first item to see
whether it can be serialized at the new timing.

But this implementation may be very slow when there are a lot of newly
added DOM since it will do an O(n^2) iteration.

For example, if we have three newly added DOM `n1`, `n2`, `n3`,
the iteration looks like this:
```
[n1, n2, n3]
	n1 -> n2 -> n3, consume n3
[n1, n2]
	n1 -> n2, consume n2
[n1]
	n1, consume n1
```
We should have a better performance if te iteration looks like this:
```
[n1, n2, n3]
	n3, consume n3
[n1, n2]
	n2, consume n2
[n1]
	n1, consume n1
```

Simply reverse the mutation payload does not work, because it does
not always as same as the DOM order.

So in this patch, we replace the `addQueue` with a double linked list,
which can:
1. represent the DOM order in its data structure
2. has an O(1) time complexity when looking up the sibling of a list item
3. has an O(1) time complexity when removing a list item
@Yuyz0112
Copy link
Member

#284 may relate to this issue. It's appreciated if anyone can help verify whether the issue still happen with v0.9.1.

@Yuyz0112
Copy link
Member

Please reopen this if there is any further information.

@ZakYahi
Copy link

ZakYahi commented Jan 20, 2021

Hello @kubadospial,
Did you fix your problem?
I have a similar crash when I hover a element that displays a tooltip.
Your help would be appreciated if you managed to fix your problem.

@aserec
Copy link

aserec commented Apr 28, 2021

It says was fixed in the commit 13f1a61. I've tried with angular 9, then upgraded to 10 and finally to 11. They all face the same result. Screen gets frozen. I've used the example code readme for the recording. I'm using ngx-bootstrap.

This was done in Feb, was it truly fixed?

@Yuyz0112
Copy link
Member

@aserec Could you open a new issue and provide a reproducible code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants