Skip to content

std.posix.sendmsg() may return error(110) ETIMEDOUT on linux. Added mapping for error.ConnectionTimedOut #25815

@zigster64

Description

@zigster64

Zig Version

0.15.2

Steps to Reproduce and Observed Behavior

Difficult to reproduce due to linux versions, architectures, and local conditions affecting socket time outs, which may all vary.

The linux manpage does not explicitly show ETIMEDOUT as an error value for sendmsg, other than to say
"Additional errors may be generated and returned from the underlying protocol modules"

Server is running Linux on Arm64 in this case :
6.12.48+deb13-arm64

Server is a Hetzner VPS, using a Neoverse N1 (arm64) CPU

Observed behaviour :

  • Server listens for incoming connections, accepts a connection, and retains the fd for the newly opened stream
  • Client disconnects
  • 24hr later, the server attempts to write to that retained fd using std.posix.sendmsg()
  • stderr reports "unexpectedErrno: 110", or ETIMEDOUT on linux

Cannot reproduce on FreeBSD - running the same scenario, the failed sendmsg() to the dead fd reports a known errno and is handled cleanly

Expected Behavior

Expect that ETIMEDOUT errors on std.posix.sendmsg() are returned as a known SendMsgError type

Have applied the related patch to my local zig stdlib on the test machine, rebuilt the app, and have been running with it for a week. Not seeing any more unhandled ETIMEDOUT errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions