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 Agma Module Shutdown() test #3844

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Fix Agma Module Shutdown() test #3844

wants to merge 8 commits into from

Conversation

guscarreon
Copy link
Contributor

@guscarreon guscarreon commented Aug 7, 2024

Test TestShutdownFlush sometimes fails the AssertCalled() check when run from the validate.sh script due to a race condition that the time.Sleep() call in line 697 is unable to avoid if the goroutine go l.sender(payload) inside flush() takes longer to get run by golang's goroutine scheduler than the 10 millisecond wait.

This pull request refactors TestShutdownFlush so no go l.sender(payload) goroutine gets called so the occurence of a race condition is less likely.

@bsardo bsardo self-assigned this Aug 14, 2024
glog.Warning("[AgmaAnalytics] fail to copy the buffer")
return
}

go l.sender(payload)

l.reset()
l.mux.Unlock()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Given that payload is a copy, l.reset() and l.mux.Unlock() should be moved upstream so the memory is unlocked and available for other processes in case go l.sender(payload) gets run before the remainder of flush().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants