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

apollo-server-core: Fix delayed shutdown bug in schemaReporter.ts #5222

Merged
merged 1 commit into from May 18, 2021

Conversation

sachindshinde
Copy link
Contributor

In this PR, schemaReporter.ts is changed to fix a bug where calling stop() may not prevent functions from being executed in the future via setTimeout(). The specific case is when:

  1. sendOneReportAndScheduleNext() is suspended while waiting on a response from Studio.
  2. stop() is called and finishes execution.
  3. sendOneReportAndScheduleNext() resumes execution, and calls setTimeout() to schedule another invocation of sendOneReportAndScheduleNext() some time in the future (usually 60 seconds).
  4. sendOneReportAndScheduleNext() executes in the future, but early-returns because it checks this.isStopped().

The end result is Node being prevented from clean shutdown for ~60 seconds in such cases.

…ndScheduleNext() is suspended would still result in setTimeout() being called.
@glasser glasser merged commit a43c411 into main May 18, 2021
@glasser glasser deleted the sachin/fix-delayed-shutdown-bug-schema-reporting branch May 18, 2021 22:49
glasser added a commit that referenced this pull request May 18, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 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.

None yet

2 participants