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

Handle streaming loop if client has disconnected #48

Closed
aniketmaurya opened this issue Apr 16, 2024 · 4 comments
Closed

Handle streaming loop if client has disconnected #48

aniketmaurya opened this issue Apr 16, 2024 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@aniketmaurya
Copy link
Collaborator

🚀 Feature

If the client is disconnected while streaming the response we still complete the loop. We can stop the loop on BrokenPipeError.

x = lit_api.decode_request(x_enc)
y_gen = lit_api.predict(x)
y_enc_gen = lit_api.encode_response(y_gen)
for y_enc in y_enc_gen:
    ####### Detect disconnected client on BrokenPipeError  ############
    with contextlib.suppress(BrokenPipeError):
        pipe_s.send(y_enc)

Motivation

Pitch

Alternatives

Additional context

cc: @lantiga

@aniketmaurya aniketmaurya added enhancement New feature or request help wanted Extra attention is needed labels Apr 16, 2024
@aniketmaurya
Copy link
Collaborator Author

@lantiga we should stop processing request if the client has disconnected and allow other requests in the queue to process. wdyt?

@andyland
Copy link
Contributor

andyland commented Jul 2, 2024

@aniketmaurya Non-streaming requests should terminate the work if the client disconnects as well: https://www.loom.com/share/d6d97f0f34fd4084a72ff99471581cd7

@aniketmaurya
Copy link
Collaborator Author

@andyland in the case when the model worker has picked your request from queue and has started processing then we can't cancel it out unless we do some process communication which might add some bottlenecks but it's definitely worth looking into. Thanks for raising it.

@aniketmaurya
Copy link
Collaborator Author

the internal architecture has changed and we will solve it in a different way. This issue is now to be tracked in #165

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants