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): Ensure TTL safeguard for test webhooks applies only to multi-main setup #9062

Merged
merged 1 commit into from Apr 5, 2024

Conversation

ivov
Copy link
Contributor

@ivov ivov commented Apr 4, 2024

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 use expire with the in-memory cache.

Thanks @valya for pointing this out.

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

cypress bot commented Apr 4, 2024

2 flaky tests on run #4595 ↗︎

0 353 12 0 Flakiness 2

Details:

🌳 fix-flaky-ndv-test 🖥️ browsers:node18.12.0-chrome107 🤖 milorad 🗃️ e2e/*
Project: n8n Commit: f756e3cdc4
Status: Passed Duration: 04:18 💡
Started: Apr 5, 2024 12:37 PM Ended: Apr 5, 2024 12:41 PM
Flakiness  cypress/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 #9062 ↗︎

Copy link
Contributor

github-actions bot commented Apr 4, 2024

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

1 similar comment
Copy link
Contributor

github-actions bot commented Apr 5, 2024

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

Copy link
Contributor

github-actions bot commented Apr 5, 2024

✅ All Cypress E2E specs passed

@ivov ivov merged commit ff81de3 into master Apr 5, 2024
32 checks passed
@ivov ivov deleted the fix-core-ttl-safeguard-only-for-multi-main-setup branch April 5, 2024 12:15
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)
@github-actions github-actions bot mentioned this pull request Apr 10, 2024
@janober
Copy link
Member

janober commented Apr 10, 2024

Got released with n8n@1.37.0

netroy pushed a commit that referenced this pull request Apr 11, 2024
@github-actions github-actions bot mentioned this pull request Apr 11, 2024
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