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

[GOAL2-784] Fix random network unit test failures #75

Merged
merged 4 commits into from
Jun 21, 2019

Conversation

tsachiherman
Copy link
Contributor

Summary

Our existing websocket library would fail to flush the first few messages, as long as the messages accumulated size is below 4096 bytes.

Explanation

The websocket library is creating a thread that is responsible for flushing the pending buffer content. When a write operation is complete, the flushing thread is being woken up to flush the buffer content.
The issue is that upon startup, the connection might get created, followed by several messages being sent. If that happens before the flushing thread start to execute, the flushing thread might miss the signal which indicates it needs to flush the outgoing buffer content.

In the context of our unit tests, where we send two small messages and wait until they reach the other socket, it being expressed as a flaky test.

Solution

The first for this is pretty straight forward; on the flushing thread, just flush the content of the buffer upon startup without waiting for a signal. Then, wait for the signal which would handle the subsequent iteration.

@tsachiherman tsachiherman changed the title Tsachi/nettestfail2 [GOAL2-784] Fix random network unit test failuires Jun 21, 2019
@tsachiherman tsachiherman changed the title [GOAL2-784] Fix random network unit test failuires [GOAL2-784] Fix random network unit test failures Jun 21, 2019
@Vervious
Copy link
Contributor

Fixes #74

derbear pushed a commit to derbear/go-algorand that referenced this pull request May 12, 2020
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