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

Resolve stopQuery/broadcastQueries race condition #232

Merged
merged 2 commits into from
May 23, 2016
Merged

Resolve stopQuery/broadcastQueries race condition #232

merged 2 commits into from
May 23, 2016

Conversation

bruce
Copy link
Contributor

@bruce bruce commented May 23, 2016

  • Update CHANGELOG.md with your change
  • Make sure all of the significant new logic is covered by tests (Small change to avoid race condition, hard to effectively reproduce in tests.)
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass (There are pre-existing middleware tests in master that currently fail for me intermittently due to timeouts, but this change has no effect on test failures.)

Fix for #231.

  • Add check for listener in QueryManager's broadcastQueries()

It is possible the deletion of a query listener in stopQuery()
and the forOwn iteration of query listeners in broadcastQueries() to
overlap, causing a race condition. This explicitly checks that
the listener exists before attempting to invoke it.

* Add check for `listener` in QueryManager's `broadcastQueries()`

It is possible the deletion of a query listener in `stopQuery()`
and the `forOwn` iteration of query listeners in `broadcastQueries()` to
overlap, causing a race condition. This commit explicitly checks that
the listener exists before attempting to invoke it.
@apollo-cla
Copy link

@bruce: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

@stubailo
Copy link
Contributor

Looks great, thank you for identifying this race condition!

@stubailo stubailo merged commit b041c59 into apollographql:master May 23, 2016
jbaxleyiii pushed a commit that referenced this pull request Oct 17, 2017
jbaxleyiii pushed a commit that referenced this pull request Oct 18, 2017
Update auth.md - add info about "withApollo"
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants