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

fix(gatsby): fix eventemitter leak in page query runner #10593

Merged
merged 1 commit into from
Dec 21, 2018

Conversation

rexxars
Copy link
Contributor

@rexxars rexxars commented Dec 21, 2018

Description

The query queue can fire the drain event multiple times, and the page query runner listens for the drain event and resolves a promise once it does. When this happens, it doesn't currently clear the resolve event handler from the queue emitter.

This PR fixes that by simply unsubscribing once the drain event is fired.

I think this may properly fix #5510

@rexxars rexxars requested a review from a team as a code owner December 21, 2018 00:33
Copy link
Contributor

@pieh pieh 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 @rexxars!

@pieh
Copy link
Contributor

pieh commented Dec 21, 2018

We probably will have other places where we don't remove event listeners

@pieh pieh merged commit 80a856f into gatsbyjs:master Dec 21, 2018
@rexxars rexxars deleted the fix/event-emitter-leak branch December 21, 2018 10:14
DSchau pushed a commit that referenced this pull request Dec 21, 2018
<!--
  Have any questions? Check out the contributing docs at https://gatsby.app/contribute, or
  ask in this Pull Request and a Gatsby maintainer will be happy to help :)
-->

## Description

<!-- Write a brief description of the changes introduced by this PR -->
This fixes a bug introduced in #10593 by replacing the `.off` call with `.removeListener`. `.off` was introduced in Node v10.0.0 as an alias for `.removeListener` (nodejs/node#17156).

## Related Issues

<!--
  Link to the issue that is fixed by this PR (if there is one)
  e.g. Fixes #1234, Addresses #1234, Related to #1234, etc.
-->
Related to #10612
gpetrioli pushed a commit to gpetrioli/gatsby that referenced this pull request Jan 22, 2019
gpetrioli pushed a commit to gpetrioli/gatsby that referenced this pull request Jan 22, 2019
<!--
  Have any questions? Check out the contributing docs at https://gatsby.app/contribute, or
  ask in this Pull Request and a Gatsby maintainer will be happy to help :)
-->

## Description

<!-- Write a brief description of the changes introduced by this PR -->
This fixes a bug introduced in gatsbyjs#10593 by replacing the `.off` call with `.removeListener`. `.off` was introduced in Node v10.0.0 as an alias for `.removeListener` (nodejs/node#17156).

## Related Issues

<!--
  Link to the issue that is fixed by this PR (if there is one)
  e.g. Fixes gatsbyjs#1234, Addresses gatsbyjs#1234, Related to gatsbyjs#1234, etc.
-->
Related to gatsbyjs#10612
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

Successfully merging this pull request may close these issues.

gatsby develop causes MaxListenersExceededWarning resource drain
2 participants