Skip to content

Keep live sockets usable across task executor shutdown and restart on Windows #531

Description

@LunaStev

The new IOCP provider associates a socket with _port on its first operation. iocp_shutdown drains outstanding work, closes the port handle and clears _port. A later operation creates a different port and attempts to associate the still-open socket with it. Windows retains the original completion-port association until the socket handle is closed.

The public task comments require completing/cancelling work before shutdown, but do not require closing all otherwise-live application sockets. Reusing such a socket in a subsequent block_on therefore reaches a native association failure.

Source evidence at the head of #520:

Acceptance:

  • Make port ownership compatible with the supported executor/socket lifetime, retaining the port as needed or rejecting an unsupported shutdown before invalidating reusable state.
  • Exercise read/write completion, shutdown, and a second executor session on the same live socket.
  • Also cover closing all sockets before shutdown and repeated shutdown without resource leaks.
  • Do not close caller-owned sockets implicitly or free buffers before cancellation acknowledgement.

API/reference context: CreateIoCompletionPort handle association lifetime.

Related: #444 and #445.

Audit status: identified by static source inspection; the scenarios above have not been executed during this audit. This follows up the implementation introduced in draft PR #520.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA problem that causes incorrect behavior or crashes.help wantedThe issue requires extra attention or help from others.os-specific bugA bug or issue that occurs only on a specific operating system.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions