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

tests: executionclient fix & simplify #1781

Open
wants to merge 1 commit into
base: stage
Choose a base branch
from

Conversation

iurii-ssv
Copy link
Contributor

This PR resolves potential memory leak (similar to what's described in #1780), also simplifying the test affected.

Comment on lines -192 to 197
Unfollowed:
Wait1:
for {
select {
case <-ctx.Done():
require.Equal(t, int64(blocksWithLogsLength-followDistance), streamedLogsCount.Load())
require.Failf(t, "timed out", "err: %v, streamedLogsCount: %d", ctx.Err(), streamedLogsCount.Load())
case <-time.After(time.Millisecond * 5):
if streamedLogsCount.Load() == int64(blocksWithLogsLength-followDistance) {
break Unfollowed
break Wait1
}
}
}
Copy link
Contributor Author

@iurii-ssv iurii-ssv Oct 9, 2024

Choose a reason for hiding this comment

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

So, (on stage version) if we drop into case <-ctx.Done() branch here this for loop will very likely spin perpetually (allocating new Timer on every iteration through time.After).

Copy link
Contributor

Choose a reason for hiding this comment

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

great catch

Copy link
Contributor

@nkryuchkov nkryuchkov left a comment

Choose a reason for hiding this comment

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

LGTM, approving but we need to make sure CI passes

Comment on lines -192 to 197
Unfollowed:
Wait1:
for {
select {
case <-ctx.Done():
require.Equal(t, int64(blocksWithLogsLength-followDistance), streamedLogsCount.Load())
require.Failf(t, "timed out", "err: %v, streamedLogsCount: %d", ctx.Err(), streamedLogsCount.Load())
case <-time.After(time.Millisecond * 5):
if streamedLogsCount.Load() == int64(blocksWithLogsLength-followDistance) {
break Unfollowed
break Wait1
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

great catch

Copy link
Contributor

@y0sher y0sher left a comment

Choose a reason for hiding this comment

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

lgtm :)

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.

3 participants