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 gRPC streaming non-decoupled segfault if sending response and final flag separately #7265

Merged
merged 5 commits into from
Jun 6, 2024

Conversation

kthui
Copy link
Contributor

@kthui kthui commented May 24, 2024

When using gRPC streaming for non-decoupled models, the frontend does not properly handle the case which the response and final flag are sent separately. The gRPC server will release the state as soon as the response is received, resulting in a possible segfault when the final flag is later received.

The fix is to defer sending the response if a final flag is not coupled with the response, and leave the gRPC step in WRITEREADY. Then, when the final flag is received, it continue sending the response and move to step WRITTEN.

This PR should merge before #7311

Copy link
Member

@Tabrizian Tabrizian left a comment

Choose a reason for hiding this comment

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

Can we target main and only include the related commits for this change? It looks like it is independent of other Python be changes.

@kthui kthui force-pushed the jacky-res-sender-fix-grpc branch from 03130e0 to 8a10ba4 Compare May 28, 2024 22:10
@kthui kthui changed the base branch from jacky-res-sender-main to main May 28, 2024 22:10
@kthui
Copy link
Contributor Author

kthui commented May 28, 2024

All non-related commits are removed and the PR is now targeting the main branch.

Tabrizian
Tabrizian previously approved these changes May 30, 2024
@kthui kthui force-pushed the jacky-res-sender-fix-grpc branch 3 times, most recently from c08292b to 8799aec Compare June 4, 2024 00:04
Tabrizian
Tabrizian previously approved these changes Jun 5, 2024
oandreeva-nv
oandreeva-nv previously approved these changes Jun 5, 2024
Copy link
Contributor

@oandreeva-nv oandreeva-nv left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks for elaborations!

@kthui kthui dismissed stale reviews from oandreeva-nv and Tabrizian via 178b65b June 5, 2024 21:22
Copy link
Contributor

@oandreeva-nv oandreeva-nv left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -79,7 +80,7 @@ def _prepare_inputs_and_outputs(self, kind):
self.outputs_.append(grpcclient.InferRequestedOutput("OUT"))
self.outputs_.append(grpcclient.InferRequestedOutput("IDX"))
self.requested_outputs_ = self.outputs_
elif kind == "simple" or kind == "streaming":
elif kind in ("simple", "streaming"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just curious, what is streaming compared to decoupled_streaming and non_decoupled_streaming?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The decoupled_streaming and non_decoupled_streaming are for the repeat_int32 and repeat_int32_non_decoupled models on repeat backend. The simple and streaming are for the custom_zero_1_float32 model on identity backend.

I think we could do some refactoring on how the inputs are prepared, i.e. for the repeat backend, we can have a function that returns a inputs that can be used directly on the client.async_stream_infer().

Copy link
Collaborator

@rmccorm4 rmccorm4 left a comment

Choose a reason for hiding this comment

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

LGTM, just one question: https://github.com/triton-inference-server/server/pull/7265/files#r1628592664. Doesn't need to be fixed/addressed here, just curious.

@kthui kthui merged commit 797d296 into main Jun 6, 2024
3 checks passed
@kthui kthui deleted the jacky-res-sender-fix-grpc branch June 6, 2024 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants