• Felix Lange's avatar
    p2p/discover: fix race involving the seed node iterator · b4374436
    Felix Lange authored
    nodeDB.querySeeds was not safe for concurrent use but could be called
    concurrenty on multiple goroutines in the following case:
    
    - the table was empty
    - a timed refresh started
    - a lookup was started and initiated refresh
    
    These conditions are unlikely to coincide during normal use, but are
    much more likely to occur all at once when the user's machine just woke
    from sleep. The root cause of the issue is that querySeeds reused the
    same leveldb iterator until it was exhausted.
    
    This commit moves the refresh scheduling logic into its own goroutine
    (so only one refresh is ever active) and changes querySeeds to not use
    a persistent iterator. The seed node selection is now more random and
    ignores nodes that have not been contacted in the last 5 days.
    b4374436
Name
Last commit
Last update
Godeps Loading commit data...
_data Loading commit data...
accounts Loading commit data...
build Loading commit data...
cmd Loading commit data...
common Loading commit data...
compression/rle Loading commit data...
core Loading commit data...
crypto Loading commit data...
docker Loading commit data...
errs Loading commit data...
eth Loading commit data...
ethdb Loading commit data...
event Loading commit data...
generators Loading commit data...
jsre Loading commit data...
logger Loading commit data...
metrics Loading commit data...
miner Loading commit data...
p2p Loading commit data...
params Loading commit data...
pow Loading commit data...
rlp Loading commit data...
rpc Loading commit data...
tests Loading commit data...
trie Loading commit data...
whisper Loading commit data...
xeth Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gitmodules Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
COPYING Loading commit data...
COPYING.LESSER Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
VERSION Loading commit data...