Skip to content

Check which Windows not-found codes isConnectionTerminatedError() should treat as a client hang-up #19756

Open

Description

@kevinushey

Summary

On Windows, isConnectionTerminatedError() in src/cpp/core/include/core/http/SocketUtils.hpp treats a native ERROR_FILE_NOT_FOUND as the client closing the connection, but not ERROR_PATH_NOT_FOUND or the other Win32 codes that Boost maps to errc::no_such_file_or_directory (ERROR_INVALID_NAME, ERROR_BAD_NETPATH, ...).

That split looks accidental. The check was error == systemError(errc::no_such_file_or_directory, ...), which built a system-category code 2, and on Windows code 2 happens to be ERROR_FILE_NOT_FOUND (see #19745). The intent was probably a missing unix domain socket (ENOENT).

#19753 keeps the current behavior. Switching the check to isNotFoundError() would also accept ERROR_PATH_NOT_FOUND, which isConnectionUnavailableError() in the same file deliberately treats as a permanent named-pipe error, so the two helpers would disagree.

To check

  • Whether I/O on an established named-pipe connection can fail with ERROR_FILE_NOT_FOUND at all, or whether the Windows side of this match is dead code.
  • Whether ERROR_PATH_NOT_FOUND, or the other not-found codes, can show up when the client goes away, in which case they should count as a hang-up too.
  • That the answer stays consistent with isConnectionUnavailableError().

Callers use the result to decide whether to log an error, so a match that is too broad hides misconfiguration (e.g. a bad pipe path), and one that is too narrow logs routine disconnects. Windows callers include SessionNamedPipeHttpConnectionListener.hpp, SessionHttpConnectionImpl.hpp and AsyncConnectionImpl.hpp.

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

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions