Skip to content

[Proxying][Docs] Improve the docs for proxying with callback #18359

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

Merged
merged 2 commits into from
Dec 13, 2022

Conversation

tlively
Copy link
Member

@tlively tlively commented Dec 12, 2022

Make it clear that work is asynchronously proxied in both directions and that
the return code is determined only by whether the initial work is proxied.

The tests in test_pthread_proxying_cpp proxy functions that increment local
variables. For the async proxying functions, the proxying is followed by a wait
on a condition variable so the test can assert that the proxied work was
completed. However, the incrementing of the local variables was not protected by
the lock used with the condition variable, so it was possible for the variable
to be incremented and the condition variable notified after checking the wait
condition but before waiting. Since the condition variable would not be notified
again, the test would wait on the condition variable forever.

Fix the bug by taking the lock before incrementing the variable in tests where
this could cause problems.

Fixes #18353.
Make it clear that work is asynchronously proxied in both directions and that
the return code is determined only by whether the initial work is proxied.
@tlively
Copy link
Member Author

tlively commented Dec 12, 2022

@kripken
Copy link
Member

kripken commented Dec 13, 2022

What happens if it fails the second enqueue operation? Is it silently dropped or do we abort?

@tlively
Copy link
Member Author

tlively commented Dec 13, 2022

It's silently dropped, but the only way that can happen is if there is an allocation failure, and those are typically assumed not to happen in practice. I suppose we could abort instead. Do you think that would be better?

@kripken
Copy link
Member

kripken commented Dec 13, 2022

I think aborting is better, though I could see a case for removing that check in a no-assertions build. Might be worth documenting that either way. Was that already an issue with the previous proxying commands?

Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

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

Either way lgtm, thanks, this PR is a good improvement.

Base automatically changed from fix-proxying-test-deadlock to main December 13, 2022 00:57
{
std::unique_lock<std::mutex> lock(mutex);
i = 3;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

From the other change?

@tlively tlively merged commit 941884a into main Dec 13, 2022
@tlively tlively deleted the precise-callback-docs branch December 13, 2022 16:03
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