Skip to content

fix(p2p): fix race condition caused by startTestNetwork#801

Merged
nashqueue merged 1 commit intoevstack:mainfrom
Wondertan:hlib/fix-race-p2p
Mar 23, 2023
Merged

fix(p2p): fix race condition caused by startTestNetwork#801
nashqueue merged 1 commit intoevstack:mainfrom
Wondertan:hlib/fix-race-p2p

Conversation

@Wondertan
Copy link
Copy Markdown
Contributor

@Wondertan Wondertan commented Mar 23, 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

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
@Wondertan Wondertan changed the title fix(p2p): fix race condition cause by startTestNetwork fix(p2p): fix race condition caused by startTestNetwork Mar 23, 2023
@Manav-Aggarwal Manav-Aggarwal self-requested a review March 23, 2023 11:21
Copy link
Copy Markdown
Collaborator

@tuxcanfly tuxcanfly left a comment

Choose a reason for hiding this comment

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

OK.

Copy link
Copy Markdown
Contributor

@nashqueue nashqueue left a comment

Choose a reason for hiding this comment

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

image

@nashqueue nashqueue merged commit b62e97f into evstack:main 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants