Skip to content

Fix portable error handling on native Windows - #192

Draft
binaryfire wants to merge 5 commits into
swoole:masterfrom
binaryfire:fix/portable-errno-consumers
Draft

Fix portable error handling on native Windows#192
binaryfire wants to merge 5 commits into
swoole:masterfrom
binaryfire:fix/portable-errno-consumers

Conversation

@binaryfire

@binaryfire binaryfire commented Aug 12, 2026

Copy link
Copy Markdown

Swoole normalizes native Windows socket failures into its portable errno domain. PHP's SOCKET_E* constants use Winsock values there, so the library can miss timeouts, resource limits, and packet errors.

This switches the coroutine server, FastCGI client, and sockets compatibility functions to SWOOLE_ERRNO_E*. It also makes Coroutine\Server::start() return false with the socket error after a fatal accept failure and leave its lifecycle state consistent.

The tests cover the affected public paths.

This depends on swoole-src#6152 and must not merge until its release version is known and the Composer minimum is updated.

Compare coroutine server failures against Swoole's normalized errno domain so native Windows timeouts and resource limits take the intended paths.

Return false with the socket error on fatal accept failures, and leave the running flag false after every start result. Add focused coverage for timeout retries, cancellation, setup failures, and fatal errors.
Use Swoole's normalized connection-reset and protocol error values when FastCGI packet reads fail.

Cover empty and malformed packets with constructed socket doubles that exercise the public client workflow without opening a connection.
Set the coroutine socket's public error code from Swoole's errno family when a zero-length compatibility receive is rejected.

Exercise the branch with a real datagram coroutine socket so the published value stays tied to the runtime error domain.
Document the native Windows error-domain correction and the accurate coroutine server start result in the Unreleased section.
Attach the pull request number and contributor credit to the Unreleased error-handling entry now that GitHub has assigned it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant