Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix network discovery & start Node asynchronously #648

Merged
merged 5 commits into from
Mar 12, 2020

Conversation

AndrejMitrovic
Copy link
Contributor

This fixes the network discovery issue #647. While creating a test-case I've realized that #276 is actually blocking the implementation of a test-case. So this PR includes two fixes.

Fixes #276
Fixes #647

@AndrejMitrovic AndrejMitrovic added type-bug Things don't work as they were intended to, or the way they were intended to work doesn't make sense type-enhancement An improvement of existing functionalities labels Mar 11, 2020
@codecov
Copy link

codecov bot commented Mar 11, 2020

Codecov Report

Merging #648 into v0.x.x will increase coverage by 0.07%.
The diff coverage is 93.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           v0.x.x     #648      +/-   ##
==========================================
+ Coverage   90.13%   90.21%   +0.07%     
==========================================
  Files          62       62              
  Lines        4623     4648      +25     
==========================================
+ Hits         4167     4193      +26     
+ Misses        456      455       -1
Flag Coverage Δ
#integration 54.62% <100%> (+1.17%) ⬆️
#unittests 88.94% <93.33%> (+0.08%) ⬆️
Impacted Files Coverage Δ
source/agora/network/NetworkManager.d 79.61% <100%> (+0.77%) ⬆️
source/agora/node/Node.d 100% <100%> (ø) ⬆️
source/agora/test/GossipProtocol.d 91.89% <100%> (+0.22%) ⬆️
source/agora/test/NetworkDiscovery.d 88.88% <88.88%> (ø)
source/agora/test/Base.d 89.67% <92.3%> (+1.17%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0120d68...7e69a41. Read the comment docs.

@AndrejMitrovic
Copy link
Contributor Author

The asynchronous start has managed to find a bug: https://github.com/bpfkorea/agora/pull/649/files

@AndrejMitrovic AndrejMitrovic force-pushed the fix-discovery branch 2 times, most recently from d2041b1 to 1683f81 Compare March 11, 2020 06:27
AndrejMitrovic added a commit to AndrejMitrovic/agora that referenced this pull request Mar 11, 2020
It will be used in a later test.
@AndrejMitrovic AndrejMitrovic force-pushed the fix-discovery branch 2 times, most recently from f294696 to c8831a1 Compare March 12, 2020 00:38
Otherwise using 'dtest=agora.test.Network dub test' will also run
tests in agora.test.NetworkClient.d and agora.test.NetworkManager.d,
because both partially match the string.
This allows the test-suite to start multiple nodes
in parallel without waiting for the discovery phase
of one node to complete before another node's discovery
begins.

Without this we cannot test network discovery properly
due to a race condition:

A.start() => calls B.getNetworkInfo()

However B's network info will always be empty because B.start()
was never called, because the main thread is stuck waiting
for A.start() to return.

Fixes bosagora#276
The network info was discarded instead of used.

Fixes bosagora#647
@AndrejMitrovic
Copy link
Contributor Author

@bpfkorea/core this is blocking other PRs. Could you please review? :)

Copy link
Contributor

@linked0 linked0 left a comment

Choose a reason for hiding this comment

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

I reviewed all the codes yesterday.
It looks good to me.

Copy link
Member

@TrustHenry TrustHenry left a comment

Choose a reason for hiding this comment

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

LGTM
I'll be do merge when the CI test is over

this.network.discover();

bool isNominating ()
this.taskman.runTask(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@AndrejMitrovic AndrejMitrovic Mar 12, 2020

Choose a reason for hiding this comment

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

I saw that, but I think I left it in out of misunderstanding. I'll remove it in a fixup PR.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I didn't see this in detail.
It was wrapped twice.

@AndrejMitrovic AndrejMitrovic deleted the fix-discovery branch March 12, 2020 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Things don't work as they were intended to, or the way they were intended to work doesn't make sense type-enhancement An improvement of existing functionalities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Network discovery is broken (due to lack of a proper test) TestAPIManager.start() is not asynchronous
4 participants