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

bugfix: watcher events loss #289

Merged
merged 3 commits into from
May 17, 2023
Merged

Conversation

oleg-jukovec
Copy link
Collaborator

Watchers may behave incorrectly if a request timeout is too small. A
re-IPROTO_WATCH request may be not send to a server. It could lead to
loss of events stream.

It also could lead to a lost IPROTO_UNREGISTER request, but a user
won't see the problem.

I didn't forget about (remove if it is not applicable):

Related issues:

Closes #284

Goroutines could set a value to `ret` shared variable without
protection. The shared variable has been replaced with a channel.

Part of #284
The change helps to make the order of execution and sending of async
requests the same.

As example:

    conn.Do(AsyncRequest1).Get()
    conn.Do(AsyncRequest2).Get()

It is now guaranteed that AsyncRequest2 will be sent to the network
after AsyncRequest1. Before the patch the order was undefined.

Part of #284
Watchers may behave incorrectly if a request timeout is too small. A
re-IPROTO_WATCH request may be not send to a server. It could lead to
loss of events stream.

It also could lead to a lost IPROTO_UNREGISTER request, but a user
won't see the problem.

Closes #284
@oleg-jukovec oleg-jukovec marked this pull request as ready for review May 15, 2023 12:33
Copy link
Member

@DifferentialOrange DifferentialOrange left a comment

Choose a reason for hiding this comment

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

It's always hard to interpret async code by reading it. Since the patch solves the issue, it seems that everything is fine here.

@oleg-jukovec oleg-jukovec merged commit 4b8254f into master May 17, 2023
@oleg-jukovec oleg-jukovec deleted the oleg-jukovec/gh-284-fix-newwatcher branch May 17, 2023 15:15
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.

Data race in TestConnection_NewWatcher_concurrent
3 participants