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

🐛amp-analytics Stop adding triggers if has been detached #18340

Merged
merged 3 commits into from
Oct 16, 2018

Conversation

zhouyx
Copy link
Contributor

@zhouyx zhouyx commented Sep 25, 2018

Attempt to fix #18231

Note: Ideally we should add the check before initiating every instance, but that's too much check.
Once we've confirmed that detachedCallback is the root cause to #18231, we can remove the this.hasDetached_ and check for this.analyticsGroup_ instead.

@lannka
Copy link
Contributor

lannka commented Sep 25, 2018

I think we should just go ahead and check this.analyticsGroup_. We will not learn too much from this.hasDetached_.

Looking at the code, the race condition can happen from 2 places:

  • L281: this.isSampledIn_(trigger)
  • L297: this.variableService_.expandTemplate

Once either of the above async execution took too much time and amp-analytics gets detached from DOM, we will get this error. So we definitely to have a null check to protect.

@zhouyx
Copy link
Contributor Author

zhouyx commented Oct 3, 2018

As I mentioned I agree that check for this.analyticsGroup_ is the way to go, I want to make sure that element being detached from DOM is the only root cause to the error. That's why I want to introduce this.hasDetached_ first and later migrate to this.analyticsGroup_

@zhouyx
Copy link
Contributor Author

zhouyx commented Oct 10, 2018

@lannka Changed to check this.analyticsGroup_. PTAL

@zhouyx
Copy link
Contributor Author

zhouyx commented Oct 15, 2018

Friendly ping

@zhouyx zhouyx merged commit e4385f1 into ampproject:master Oct 16, 2018
@zhouyx zhouyx deleted the check-detach branch October 16, 2018 20:59
noranazmy pushed a commit to noranazmy/amphtml that referenced this pull request Oct 18, 2018
…18340)

* check if has detached

* change check to analyticsGroup

* fix test
Enriqe pushed a commit to Enriqe/amphtml that referenced this pull request Nov 28, 2018
…18340)

* check if has detached

* change check to analyticsGroup

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

Successfully merging this pull request may close these issues.

Failed to process trigger "ad-request-start"
3 participants