Skip to content

ssl: Fix windows IOCP socket path - #11510

Open
dgud wants to merge 1 commit into
erlang:maintfrom
dgud:dgud/ssl/async-completion
Open

ssl: Fix windows IOCP socket path#11510
dgud wants to merge 1 commit into
erlang:maintfrom
dgud:dgud/ssl/async-completion

Conversation

@dgud

@dgud dgud commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

When events (renegotiate, alert, post_handshake_data) arrive during an async send, they are postponed and low is set to 0 as a signal to keep the sender in async_wait until the buffer fully drains.

In do_async_send/6, the {completion, _} branch called new_async/1 which overwrote low with the default (4096), losing the signal. This caused unnecessary state ping-pong between async_wait and connection on Windows (IOCP) when postponed events were pending.

Preserve low from the original async record and guard the transition to connection on low > 0.

When events (renegotiate, alert, post_handshake_data) arrive during
an async send, they are postponed and low is set to 0 as a signal
to keep the sender in async_wait until the buffer fully drains.

In do_async_send/6, the {completion, _} branch called new_async/1
which overwrote low with the default (4096), losing the signal.
This caused unnecessary state ping-pong between async_wait and
connection on Windows (IOCP) when postponed events were pending.

Preserve low from the original async record and guard the
transition to connection on low > 0.
@dgud
dgud changed the base branch from master to maint August 19, 2026 10:08
@dgud dgud self-assigned this Aug 19, 2026
@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

CT Test Results

    2 files     66 suites   25m 18s ⏱️
  831 tests   785 ✅  46 💤 0 ❌
4 328 runs  3 367 ✅ 961 💤 0 ❌

Results for commit 4b20af8.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@dgud dgud added team:PS Assigned to OTP team PS testing currently being tested, tag is used by OTP internal CI bug Issue is reported as a bug labels Aug 19, 2026
@dgud
dgud requested review from IngelaAndin and a lite review from Copilot August 20, 2026 10:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a Windows (IOCP) edge case in tls_sender where postponed TLS events (renegotiate/alert/post-handshake data) could be mishandled during an in-flight async send due to the async buffer’s low watermark being reset to the default value.

Changes:

  • Preserves low from the existing async buffer when rebuilding async state in the {completion, _} send path.
  • Guards the transition back to the connection state on low > 0 to avoid ping-ponging when postponed events are pending.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@IngelaAndin

Copy link
Copy Markdown
Contributor

@dgud I think it looks good maybe you could add a code comment, as for now I would not understand the code without the commit message for this PR.

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

Labels

bug Issue is reported as a bug team:PS Assigned to OTP team PS testing currently being tested, tag is used by OTP internal CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants