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): Ensure TTL safeguard for test webhooks applies only to multi-main setup #9062
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n8n-assistant
bot
added
core
Enhancement outside /nodes-base and /editor-ui
n8n team
Authored by the n8n team
labels
Apr 4, 2024
krynble
approved these changes
Apr 4, 2024
2 flaky tests on run #4595 ↗︎
Details:
cypress/e2e/5-ndv.cy.ts • 2 flaky tests
Review all test suite changes for PR #9062 ↗︎ |
|
1 similar comment
|
✅ All Cypress E2E specs passed |
MiloradFilipovic
added a commit
that referenced
this pull request
Apr 5, 2024
* master: refactor(core)!: Remove legacy `--file` flag for `execute` CLI command (#9054) fix(core): Ensure TTL safeguard for test webhooks applies only to multi-main setup (#9062) ci: Delete some duplicate code in cli tests (no-changelog) (#9049) refactor(core, editor): Remove legacy `nodesAccess` (no-changelog) (#9016) refactor(editor): Remove legacy audit logs view (no-changelog) (#9053) refactor(editor): Do not make rest api calls for disabled features (no-changelog) (#9046)
Merged
Got released with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In multi-main setup, in a manual webhook execution, it is possible that the main process that handles a webhook is not the same as the main process that created the webhook. It is the creator's responsibility to deregister all test webhooks from the cache, so for the case where the creator crashes before deregistering, we set a TTL as a safeguard. See #8267.
However, in single-main setup, setting the TTL via
setTimeout
in the in-memory cache is causing the webhook to be deregistered whenever the TTL expires, e.g. a test webhook can be blocked from cancelling because it was prematurely removed by an unrelated TTL. The root issue is that the timeout from the in-memory cache is not managed - it survives and is never cleared.Since the risk that the TTL protects against exists only in a multi-main setup, and since the in-memory implementation of
expire
is not used elsewhere at all, this PR skips the TTL in single-main setup and throws an error on trying to useexpire
with the in-memory cache.Thanks @valya for pointing this out.