The Status module that consumes go-ethereum https://status.im
Go to file
Andrea Maria Piana 24a30d7a7c Fix deadlock in peerpoool
This is a bit complicated, so:

1) Peerpool was subscribing to `event.Feed`, which is a global event
emitter for ethereum.
2) The p2p.Server was publshing on `event.Feed`, this triggered in the
same routine a publish on `event.Feed`.
3) Peerpool was listening to `event.Feed`, react on it, and in the same
routine, trigger some code on p2p.Server that would publish on
`event.Feed`

This meant that if the size of the channel was unbufferred, it would deadlock, as
peerPool would not be consuming when it would publish (the same go
routine publishes and listen effectively, through a lot of indirection
and non-buffered channels, p2p.Server->event.Feed)

The channel though was a buffered channel with size 10, and this meant that most of the times is
fine.

The issue is that peerpool is not the only producer to this channel.
So it's possible that while is processing an event, the buffer would
fill up, and it would hange trying to publish, and nobody is listening
to the channel, hanging EVERYTHING.

At least that's what I think, needs to be tested, but definitely an
issue.

I kept the code changes to a minimum, this code is a bit hairy, but it's
fairly critical so I don't want to make too many changes.
2021-01-29 14:15:44 +01:00
.dependabot Patch/dependabot protocol (#1980) 2020-05-19 00:14:02 +01:00
.github Move to monorepo structure (#1684) 2019-11-21 17:19:22 +01:00
.vscode Add go.formatFlags to VS Code settings 2020-01-16 13:18:36 +01:00
_assets compose: parametrize docker image, bind to v0.64.3 2021-01-20 14:58:28 +01:00
_examples Explain how to run Waku node in README (#1921) 2020-04-09 18:33:53 +02:00
account Upgrade linter and address issues 2020-12-28 16:55:14 +01:00
api Add export/import methods 2021-01-26 09:39:54 +01:00
appdatabase Clean topics that we don't listen to 2021-01-26 09:39:57 +01:00
bridge Clean topics that we don't listen to 2021-01-26 09:39:57 +01:00
build/bin add .gitkeep to build/bin so it always exists 2019-03-05 14:22:00 +01:00
cmd Revert "Expand Local Notifications to support multiple Notification types (#2100)" 2021-01-26 09:40:05 +01:00
config Enabled push notifications by default and add fleet 2020-08-27 18:54:06 +02:00
contracts Use goimports instead of gofmt 2020-01-06 10:17:23 +01:00
db Use goimports instead of gofmt 2020-01-06 10:17:23 +01:00
discovery Upgrade linter and address issues 2020-12-28 16:55:14 +01:00
eth-node Clean topics that we don't listen to 2021-01-26 09:39:57 +01:00
exportlogs Upgrade geth to 1.9.5 and Whisper (#1617) 2019-10-04 17:21:24 +02:00
extkeys Upgrade extkeys (#1878) 2020-03-04 09:30:31 +01:00
images Remove image log 2020-12-17 14:10:00 +01:00
logutils Integrate Whisper-Waku bridge in status-go (#1854) 2020-02-18 12:21:01 +01:00
mailserver Clean topics that we don't listen to 2021-01-26 09:39:57 +01:00
metrics Ignore full node flag when in topic mode 2020-03-23 15:10:07 +01:00
mobile Add export/import methods 2021-01-26 09:39:54 +01:00
multiaccounts Clean topics that we don't listen to 2021-01-26 09:39:57 +01:00
node Clean topics that we don't listen to 2021-01-26 09:39:57 +01:00
notifier Notifier package to interact with gorush notifications (#910) 2018-05-08 16:30:03 +02:00
params Clean topics that we don't listen to 2021-01-26 09:39:57 +01:00
peers Fix deadlock in peerpoool 2021-01-29 14:15:44 +01:00
profiling Add profiling with pprof (#754) 2018-03-23 14:58:40 +01:00
protocol Avoid concurrent access to contacts 2021-01-27 10:54:52 +01:00
rpc Nimbus node support 2020-01-20 13:15:17 +01:00
rtt rewrite mailserver systemd setup to a Makefile 2019-12-04 13:44:05 +01:00
services Revert "Expand Local Notifications to support multiple Notification types (#2100)" 2021-01-26 09:40:05 +01:00
signal Local notifications service (#2026) 2020-10-28 10:56:14 +03:00
sqlite Add export/import methods 2021-01-26 09:39:54 +01:00
static Clean topics that we don't listen to 2021-01-26 09:39:57 +01:00
t Clean topics that we don't listen to 2021-01-26 09:39:57 +01:00
timesource Nimbus node support 2020-01-20 13:15:17 +01:00
transactions custom nonce 2020-11-24 12:20:57 +01:00
vendor Upgrade pq library 2021-01-27 09:23:11 +01:00
waku Fix potential race condition 2021-01-26 17:58:25 +01:00
whisper Fix potential race condition 2021-01-26 17:58:25 +01:00
.codeclimate.yml add multi-account support (#1500) 2019-07-24 20:59:15 +02:00
.dockerignore Ignore *.test files from all folders (#635) 2018-02-08 14:23:08 +02:00
.gitignore Added IDE file to gitignore 2020-04-21 10:40:39 +02:00
.golangci.yml Remove protocol and eth-node submodules (#1835) 2020-02-10 12:22:37 +01:00
.travis.yml migrate to go 1.12 and go modules 2019-06-12 13:12:00 +02:00
BOOTNODE.md docs: clarify purpose and describe ports 2020-02-06 18:44:23 +01:00
CONTRIBUTING.md Update team collaboration forum (#1946) 2020-04-21 08:12:01 +01:00
LICENSE.md Create LICENSE.md 2016-09-21 10:00:29 +08:00
MAILSERVER.md expose the mailserver metrics port by default 2020-04-08 17:08:49 +02:00
Makefile Makefile: add v prefix to version read from VERSION file 2021-01-26 18:26:15 +01:00
README.md Explain how to run Waku node in README (#1921) 2020-04-09 18:33:53 +02:00
RELEASING.md update RELEASING docs links to CI (#1506) 2019-06-28 10:37:34 +02:00
VERSION Avoid concurrent access to contacts 2021-01-27 10:54:52 +01:00
WAKU.md Create WAKU.md with spec support (#1855) 2020-02-21 17:56:15 +08:00
go.mod Upgrade pq library 2021-01-27 09:23:11 +01:00
go.sum Upgrade pq library 2021-01-27 09:23:11 +01:00