fix(p2p): fix race condition caused by startTestNetwork#801
Merged
nashqueue merged 1 commit intoevstack:mainfrom Mar 23, 2023
Merged
fix(p2p): fix race condition caused by startTestNetwork#801nashqueue merged 1 commit intoevstack:mainfrom
nashqueue merged 1 commit intoevstack:mainfrom
Conversation
The require.NotEmpty utility reads throught struct field of the Host, while internal background routine in the host access this field as well, causing a race condition. The fix is to use require.NotNil is it only check whether the Host is nil or not without accessing it's internal fields
Manav-Aggarwal
approved these changes
Mar 23, 2023
nashqueue
pushed a commit
that referenced
this pull request
Apr 10, 2023
The `require.NotEmpty` utility reads through the struct fields of the Host via reflection, while the internal background routine in the host also accesses its field, causing race conditions. The fix is to use `require.NotNil` as it only checks whether the Host is nil or not without accessing its internal fields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The
require.NotEmptyutility reads through the struct fields of the Host via reflection, while the internal background routine in the host also accesses its field, causing race conditions. The fix is to userequire.NotNilas it only checks whether the Host is nil or not without accessing its internal fields