actix-web icon indicating copy to clipboard operation
actix-web copied to clipboard

fix(actix-http): wake before return pending when read half disconnect and need to shutdown

Open bitcapybara opened this issue 4 months ago • 0 comments

PR Type

Bug Fix

PR Checklist

  • [ ] Tests for the changes have been added / updated.
  • [ ] Documentation comments have been added / updated.
  • [ ] A changelog entry has been made for the appropriate packages.
  • [x] Format code with the latest stable rustfmt.
  • [ ] (Team) Label with affected crates and semver status.

Overview

Closes #1313

In our application, we use actix-web to forward websocket data to another service. During runtime, we discovered that when the browser closes the connection, actix-web cannot detect this event, causing tokio's io::copy call to block indefinitely. Through testing, we found that in the Dispatcher's poll method, there are the following two issues:

Because inner_p.state is not None, READ_DISCONNECT cannot be detected After returning Poll::Pending, the Dispatcher will not be polled again

This PR resolves the above two issues, allowing the client disconnect event to be properly detected and the process to exit normally.

bitcapybara avatar Jun 07 '25 07:06 bitcapybara