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(core): Disconnect Redis after pausing queue during worker shutdown #9928

Merged

Conversation

ivov
Copy link
Contributor

@ivov ivov commented Jul 3, 2024

Summary

During shutdown BaseCommand.onTerminationSignal calls ShutdownService.shutdown which eventually calls RedisClientService.disconnectClients and in parallel Worker.stopProcess pauses the queue with jobQueue.pause. If we try to pause after having disconnected, this can lead to Error from queue.

Hence call disconnectClients only after pausing the queue and after waiting for the active executions to finish. Incidentally also move the warning Redis unavailable - trying to reconnect... from the client's close event to the retry strategy to prevent confusion.

Related Linear tickets, Github issues, and Community forum posts

https://n8nio.slack.com/archives/C069YF49G8Y/p1720000315032489

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Jul 3, 2024
Copy link
Member

@netroy netroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏽

Copy link
Contributor

github-actions bot commented Jul 4, 2024

⚠️ Some Cypress E2E specs are failing, please fix them before merging

Copy link

cypress bot commented Jul 4, 2024

2 flaky tests on run #5790 ↗︎

0 399 0 0 Flakiness 2

Details:

🌳 🖥️ browsers:node18.12.0-chrome107 🤖 ivov 🗃️ e2e/*
Project: n8n Commit: 091ad9e495
Status: Passed Duration: 05:08 💡
Started: Jul 4, 2024 4:02 PM Ended: Jul 4, 2024 4:07 PM
Flakiness  e2e/5-ndv.cy.ts • 2 flaky tests

View Output Video

Test Artifacts
NDV > should not retrieve remote options when required params throw errors Screenshots Video
NDV > Stop listening for trigger event from NDV Screenshots Video

Review all test suite changes for PR #9928 ↗︎

Copy link
Contributor

github-actions bot commented Jul 4, 2024

✅ All Cypress E2E specs passed

@ivov ivov merged commit c82579b into master Jul 4, 2024
27 checks passed
@ivov ivov deleted the ensure-redis-disconnects-after-queue-pause-during-worker-shutdown branch July 4, 2024 16:07
@janober
Copy link
Member

janober commented Jul 10, 2024

Got released with [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team Released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants