Skip to content

fix(core): Per-file guard count, skip guard in 'all' mode, handle stream errors#28776

Merged
guillaumejacquart merged 1 commit intoiam-528-bug-event-log-parsing-on-startup-causes-oom-on-starter-plan-v1from
fix/iam-528-guard-improvements
Apr 21, 2026
Merged

fix(core): Per-file guard count, skip guard in 'all' mode, handle stream errors#28776
guillaumejacquart merged 1 commit intoiam-528-bug-event-log-parsing-on-startup-causes-oom-on-starter-plan-v1from
fix/iam-528-guard-improvements

Conversation

@cstuncsik
Copy link
Copy Markdown
Contributor

Summary

Follow-up fixes for #28594 addressing three issues found during review:

  • Per-file guard count: The guard was checking cumulative results.loggedMessages.length across all rotated log files. Since files are processed oldest-first, an old file tripping the limit would abort the newest file (the one with the most valuable crash recovery data). Now uses a baselineCount to track per-file growth only.
  • Skip guard in 'all' mode: In mode === 'all', confirms never prune loggedMessages (mode !== 'all' check on line 277), so the working set grows monotonically. Any log with >10k total lines would always trip the guard, breaking getMessagesAll(). Guard is now skipped in 'all' mode.
  • Stream error handler: stream.destroy() can emit an unhandled 'error' event. Added a no-op error handler to absorb it.

Review / Merge checklist

  • Tests included (2 new test cases for cross-file and 'all' mode)
  • All 4 tests passing

…m errors

- Track per-file message count via baselineCount so cross-file
  accumulation doesn't abort newer (more valuable) log files
- Skip the guard in 'all' mode where confirms don't prune
  loggedMessages, preventing false aborts on healthy files
- Add stream error handler to absorb post-destroy() errors
- Add tests for both new cases
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Bundle Report

Bundle size has no change ✅

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@n8n-assistant n8n-assistant Bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Apr 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Performance Comparison

Comparing currentlatest master14-day baseline

Memory consumption baseline with starter plan resources

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
memory-rss-baseline 342.92 MB 278.98 MB 289.99 MB (σ 41.20) +22.9% +18.3% ⚠️
memory-heap-used-baseline 114.56 MB 114.41 MB 114.45 MB (σ 0.27) +0.1% +0.1%

docker-stats

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
docker-image-size-runners 386.00 MB 386.00 MB 392.50 MB (σ 11.06) +0.0% -1.7%
docker-image-size-n8n 1269.76 MB 1269.76 MB 1273.60 MB (σ 10.49) +0.0% -0.3%

Idle baseline with Instance AI module loaded

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
instance-ai-heap-used-baseline 186.47 MB 186.52 MB 186.43 MB (σ 0.26) -0.0% +0.0%
instance-ai-rss-baseline 385.03 MB 389.20 MB 366.52 MB (σ 22.66) -1.1% +5.1%
How to read this table
  • Current: This PR's value (or latest master if PR perf tests haven't run)
  • Latest Master: Most recent nightly master measurement
  • Baseline: Rolling 14-day average from master
  • vs Master: PR impact (current vs latest master)
  • vs Baseline: Drift from baseline (current vs rolling avg)
  • Status: ✅ within 1σ | ⚠️ 1-2σ | 🔴 >2σ regression

@guillaumejacquart guillaumejacquart merged commit c74ff17 into iam-528-bug-event-log-parsing-on-startup-causes-oom-on-starter-plan-v1 Apr 21, 2026
32 of 34 checks passed
@guillaumejacquart guillaumejacquart deleted the fix/iam-528-guard-improvements branch April 21, 2026 12:13
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants