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

tsachiherman commented Jun 21, 2019

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.

merge from master
merge
merge
@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
@tsachiherman tsachiherman requested review from zeldovich and algobolson Jun 21, 2019
@zeldovich zeldovich merged commit f105c21 into algorand:master Jun 21, 2019
2 checks passed
2 checks passed
Travis CI - Pull Request Build Passed
Details
license/cla Contributor License Agreement is signed.
Details
@Vervious

This comment has been minimized.

Copy link
Contributor

Vervious commented Jul 24, 2019

Fixes #74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.