good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
ef227c5f
Unverified
Commit
ef227c5f
authored
Feb 12, 2021
by
Péter Szilágyi
Browse files
Options
Downloads
Patches
Plain Diff
core: fix temp memory blowup caused by defers holding on to state
parent
111abdcf
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/blockchain.go
+12
-1
12 additions, 1 deletion
core/blockchain.go
with
12 additions
and
1 deletion
core/blockchain.go
+
12
−
1
View file @
ef227c5f
...
...
@@ -1805,6 +1805,17 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, er
return
it
.
index
,
err
}
// No validation errors for the first block (or chain prefix skipped)
var
activeState
*
state
.
StateDB
defer
func
()
{
// The chain importer is starting and stopping trie prefetchers. If a bad
// block or other error is hit however, an early return may not properly
// terminate the background threads. This defer ensures that we clean up
// and dangling prefetcher, without defering each and holding on live refs.
if
activeState
!=
nil
{
activeState
.
StopPrefetcher
()
}
}()
for
;
block
!=
nil
&&
err
==
nil
||
err
==
ErrKnownBlock
;
block
,
err
=
it
.
next
()
{
// If the chain is terminating, stop processing blocks
if
bc
.
insertStopped
()
{
...
...
@@ -1867,7 +1878,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, er
}
// Enable prefetching to pull in trie node paths while processing transactions
statedb
.
StartPrefetcher
(
"chain"
)
defer
statedb
.
StopPrefetcher
()
// stopped on write anyway, defer meant to catch early error returns
activeState
=
statedb
// If we have a followup block, run that against the current state to pre-cache
// transactions and probabilistically some of the account/storage trie nodes.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment