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 flaky use-after-free in udp_server #10015

Merged
merged 1 commit into from
Mar 7, 2017
Merged

Conversation

rjshade
Copy link
Contributor

@rjshade rjshade commented Mar 7, 2017

Previously if both on_read and on_write were armed, and shutdown occurred, then one would fire first, decrement active_ports, and free the underlying udp_server structure. See the (error != GRPC_ERROR_NONE) handling in on_read or on_write.

This fix sets the active_ports ref count to 2, so that both on_read and on_write must fire or be cancelled before the memory is freed.

@rjshade rjshade requested a review from yang-g March 7, 2017 15:36
/* Registered for both read and write callbacks: increment active_ports
* twice to account for this, and delay free-ing of memory until both
* on_read and on_write have fired. */
s->active_ports = 2;
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean to use += instead of =?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yeah, good point. Done.

Copy link
Member

@yang-g yang-g left a comment

Choose a reason for hiding this comment

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

Please squash the commits and wait for the tests to finish. Thanks.

@rjshade rjshade merged commit 73c3354 into grpc:master Mar 7, 2017
@rjshade
Copy link
Contributor Author

rjshade commented Mar 7, 2017

Oh hang on, not sure that the tests actually ran. I saw a big green tick mark that said "All checks passed", but now after merging it says "1 of 2 checks passed".

How do I verify that tests have passed while a pull request is ongoing? I don"t see any comments from Jenkins in the comment thread.

@yang-g
Copy link
Member

yang-g commented Mar 7, 2017

I think the tests will start to run within a short period after a new commit is pushed. Before they start, it says all passed :(.

Since this change is limited to udp_server, let"s wait and see if there is anything going wrong on master. We can revert it if something related to this PR goes wrong.

@yang-g
Copy link
Member

yang-g commented Mar 7, 2017

It turns out this PR includes a submodule change, which is breaking the master. I am reverting it.

@rjshade
Copy link
Contributor Author

rjshade commented Mar 7, 2017

@yang-g I don"t get it - what did I do that introduced a submodule change?

@yang-g
Copy link
Member

yang-g commented Mar 7, 2017

Somehow in the PR, gflags is changed from 30dbc81fb5ffdc98ea9b14b1918bfe4e8779b26e to f8a0efe03aa69b3336d8e228b37d4ccb17324b88. That caused sanity test to fail on master.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants