{"record":{"id":"0e7abd961252d9a1","repo":"slackhq/nebula","slug":"winrio-socket-error-w","errorCode":null,"errorMessage":"winrio.Socket error: %w","messagePattern":"winrio\\.Socket error: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"udp/udp_rio_windows.go","lineNumber":90,"sourceCode":"\t\treturn nil, fmt.Errorf(\"bind: %w\", err)\n\t}\n\n\tfor i := 0; i < packetsPerRing; i++ {\n\t\terr = u.insertReceiveRequest()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"init rx ring: %w\", err)\n\t\t}\n\t}\n\n\tu.isOpen.Store(true)\n\treturn u, nil\n}\n\nfunc (u *RIOConn) bind(l *slog.Logger, sa windows.Sockaddr) error {\n\tvar err error\n\tu.sock, err = winrio.Socket(windows.AF_INET6, windows.SOCK_DGRAM, windows.IPPROTO_UDP)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"winrio.Socket error: %w\", err)\n\t}\n\n\t// Enable v4 for this socket\n\tsyscall.SetsockoptInt(syscall.Handle(u.sock), syscall.IPPROTO_IPV6, syscall.IPV6_V6ONLY, 0)\n\n\t// Disable reporting of PORT_UNREACHABLE and NET_UNREACHABLE errors from the UDP socket receive call.\n\t// These errors are returned on Windows during UDP receives based on the receipt of ICMP packets. Disable\n\t// the UDP receive error returns with these ioctl calls.\n\tret := uint32(0)\n\tflag := uint32(0)\n\tsize := uint32(unsafe.Sizeof(flag))\n\terr = syscall.WSAIoctl(syscall.Handle(u.sock), syscall.SIO_UDP_CONNRESET, (*byte)(unsafe.Pointer(&flag)), size, nil, 0, &ret, nil, 0)\n\tif err != nil {\n\t\t// This is a best-effort to prevent errors from being returned by the udp recv operation.\n\t\t// Quietly log a failure and continue.\n\t\tl.Debug(\"failed to set UDP_CONNRESET ioctl\", \"error\", err)\n\t}\n","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/slackhq/nebula/blob/dd8f660c0ac37903ec4080ca4d3c861ba9342ceb/udp/udp_rio_windows.go#L72-L108","documentation":"RIOConn.bind creates the UDP socket via winrio.Socket (Registered I/O socket, not the standard WSASocket) and wraps any failure as 'winrio.Socket error: <cause>'. Without an RIO socket no RIO listener can exist, so bind and listener creation abort.","triggerScenarios":"Calling udp.NewRIOListener on Windows when winrio.Socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP) fails — typically because RIO is unavailable/unsupported on the platform or WSA initialization failed.","commonSituations":"Old or stripped-down Windows installs lacking RIO; running in environments (containers, Wine) without full Winsock RIO support; WSAStartup issues in embedded hosts; IPv6 disabled on the host so AF_INET6 socket creation fails.","solutions":["Switch to the standard UDP implementation instead of RIO in the config","Enable/repair IPv6 support on the host since the socket is AF_INET6","Run on a Windows version with full Winsock RIO support (Windows 8/Server 2012+)","Unwrap the error to read the Winsock error code (WSAEAFNOSUPPORT, WSAEPROTONOSUPPORT) and address accordingly"],"exampleFix":"// before\nlisteners:\n  ring: rio\n// after — use default udp implementation\nlisteners: {}","handlingStrategy":"fallback","validationCode":"// feature-detect RIO before choosing the implementation\nrioOK := runtime.GOOS == \"windows\" && winrioSupported() // e.g. probe winrio.Socket/close\nif !rioOK { selectStandardUDPImplementation() }","typeGuard":null,"tryCatchPattern":"u, err := udp.NewRIOListener(...)\nif err != nil {\n    var werr error\n    if errors.Unwrap(err) != nil { werr = errors.Unwrap(err) }\n    if strings.Contains(err.Error(), \"winrio.Socket error\") {\n        return udp.NewListener(standardCfg) // fall back to non-RIO\n    }\n    return err\n}","preventionTips":["Only enable the RIO UDP path on Windows 8/Server 2012 or newer","Ensure IPv6 is enabled on the host (socket is AF_INET6)","Verify WSAStartup/Winsock is healthy in the hosting environment","Ship a config switch to disable RIO without code changes"],"tags":["udp","windows","winrio","socket-creation","rio"],"backgroundTag":"socket-creation-failed","analyzedSha":"dd8f660c0ac37903ec4080ca4d3c861ba9342ceb","analyzedAt":"2026-09-03T11:13:55.444Z","contentChangedAt":"2026-09-03T11:13:55.444Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}