Skip to content

core/rawdb, p2p, eth: fix graceful shutdown of pruner and dial scheduler#2079

Merged
kamuikatsurgi merged 2 commits intodevelopfrom
fix/graceful-shutdown-pruner-dialer
Feb 24, 2026
Merged

core/rawdb, p2p, eth: fix graceful shutdown of pruner and dial scheduler#2079
kamuikatsurgi merged 2 commits intodevelopfrom
fix/graceful-shutdown-pruner-dialer

Conversation

@kamuikatsurgi
Copy link
Copy Markdown
Member

Description

Feb 24 07:46:04 bor[2406527]: INFO dispatcher stopped  
Feb 24 07:46:04 bor[2406527]: INFO witness propagator stopped  
Feb 24 07:46:05 bor[2406527]: INFO Persisted dirty state to file    elapsed=3.479s  
Feb 24 07:46:05 bor[2406527]: INFO Blockchain stopped  
Feb 24 07:46:06 bor[2406527]: INFO Looking for peers                ← dial scheduler still running  
Feb 24 07:46:12 bor[2406527]: INFO witness pruner: stopping         ← 7s after blockchain stopped  
Feb 24 07:46:15 systemd[1]: bor.service: Deactivated successfully.

Issues:

  • deleteRange() has no quit check — the pruner goroutine can't respond to shutdown while pruning a large range
  • freezerdb.Close() closes the KV store before signalling pruners, so the quit signal arrives late
  • The dial scheduler keeps logging "Looking for peers" after peers are disconnected

Fixes:

  • Fix pruner blocking shutdown by checking quit signal between deleteRange batch iterations
  • Reorder freezerdb.Close() to stop pruners while the DB is still open
  • Add Server.StopDialing() to stop the dial scheduler early, suppressing "Looking for peers" during shutdown

Copy link
Copy Markdown
Collaborator

@marcello33 marcello33 left a comment

Choose a reason for hiding this comment

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

LGTM. Please fix the linter.

@sonarqubecloud
Copy link
Copy Markdown

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 24, 2026

Codecov Report

❌ Patch coverage is 55.17241% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.60%. Comparing base (d7b2be8) to head (ea6dc11).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
core/rawdb/pruner.go 41.66% 7 Missing ⚠️
core/rawdb/database.go 14.28% 4 Missing and 2 partials ⚠️

❌ Your patch status has failed because the patch coverage (55.17%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2079      +/-   ##
===========================================
- Coverage    50.62%   50.60%   -0.02%     
===========================================
  Files          875      875              
  Lines       151794   151813      +19     
===========================================
- Hits         76842    76826      -16     
- Misses       69879    69909      +30     
- Partials      5073     5078       +5     
Files with missing lines Coverage Δ
eth/backend.go 52.14% <100.00%> (+0.19%) ⬆️
p2p/server.go 73.42% <100.00%> (-0.27%) ⬇️
core/rawdb/database.go 12.26% <14.28%> (+0.28%) ⬆️
core/rawdb/pruner.go 64.70% <41.66%> (+0.32%) ⬆️

... and 14 files with indirect coverage changes

Files with missing lines Coverage Δ
eth/backend.go 52.14% <100.00%> (+0.19%) ⬆️
p2p/server.go 73.42% <100.00%> (-0.27%) ⬇️
core/rawdb/database.go 12.26% <14.28%> (+0.28%) ⬆️
core/rawdb/pruner.go 64.70% <41.66%> (+0.32%) ⬆️

... and 14 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kamuikatsurgi kamuikatsurgi merged commit 8782f6e into develop Feb 24, 2026
15 of 20 checks passed
@kamuikatsurgi kamuikatsurgi deleted the fix/graceful-shutdown-pruner-dialer branch February 24, 2026 14:00
lucca30 pushed a commit that referenced this pull request Mar 5, 2026
…ler (#2079)

* core/rawdb, p2p, eth: fix graceful shutdown of pruner and dial scheduler

* fix: lint

(cherry picked from commit 8782f6e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants