{"record":{"id":"f078b06c3896e2e0","repo":"ginuerzh/gost","slug":"deadline-not-supported-f078b0","errorCode":null,"errorMessage":"deadline not supported","messagePattern":"deadline not supported","errorType":"error_code","errorClass":"net.OpError","httpStatus":null,"severity":"info","filePath":"gost.go","lineNumber":179,"sourceCode":"\nfunc (c *nopConn) Write(b []byte) (n int, err error) {\n\treturn 0, &net.OpError{Op: \"write\", Net: \"nop\", Source: nil, Addr: nil, Err: errors.New(\"write not supported\")}\n}\n\nfunc (c *nopConn) Close() error {\n\treturn nil\n}\n\nfunc (c *nopConn) LocalAddr() net.Addr {\n\treturn nil\n}\n\nfunc (c *nopConn) RemoteAddr() net.Addr {\n\treturn nil\n}\n\nfunc (c *nopConn) SetDeadline(t time.Time) error {\n\treturn &net.OpError{Op: \"set\", Net: \"nop\", Source: nil, Addr: nil, Err: errors.New(\"deadline not supported\")}\n}\n\nfunc (c *nopConn) SetReadDeadline(t time.Time) error {\n\treturn &net.OpError{Op: \"set\", Net: \"nop\", Source: nil, Addr: nil, Err: errors.New(\"deadline not supported\")}\n}\n\nfunc (c *nopConn) SetWriteDeadline(t time.Time) error {\n\treturn &net.OpError{Op: \"set\", Net: \"nop\", Source: nil, Addr: nil, Err: errors.New(\"deadline not supported\")}\n}\n\n// splitLine splits a line text by white space, mainly used by config parser.\nfunc splitLine(line string) []string {\n\tif line == \"\" {\n\t\treturn nil\n\t}\n\tif n := strings.IndexByte(line, '#'); n >= 0 {\n\t\tline = line[:n]\n\t}","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/ginuerzh/gost/blob/a33fdbf4c98034f4bfeeaea9868909822b9c526d/gost.go#L161-L197","documentation":"nopConn.SetDeadline always returns a *net.OpError with Err 'deadline not supported'. Since the nop connection performs no I/O and blocks forever on nothing, deadlines have no meaning and the library rejects them. The error is deterministic: every call fails regardless of the time value passed.","triggerScenarios":"Calling SetDeadline(t) on a *nopConn — typically from a timeout wrapper (net.Conn deadline scaffolding, heartbeat/idle timers) applied uniformly to all connections including placeholders.","commonSituations":"Generic connection wrappers that set deadlines on every conn they touch; code paths where a discarded/placeholder connection leaks into deadline-setting logic; tests exercising timeout handling against a nopConn.","solutions":["Skip deadline configuration for nop connections (type-check or flag placeholder conns)","Ignore this specific error: check for the *net.OpError with Err 'deadline not supported' and treat as no-op","Use a real connection type if deadlines must be enforced — nopConn cannot honor them","Wrap nopConn in an adapter that implements deadline setters as no-ops if your framework requires success"],"exampleFix":"// before\nif err := conn.SetDeadline(time.Now().Add(30*time.Second)); err != nil { return err }\n// after\nif err := conn.SetDeadline(time.Now().Add(30*time.Second)); err != nil {\n  var opErr *net.OpError\n  if errors.As(err, &opErr) && opErr.Err.Error() == \"deadline not supported\" {\n    return nil // placeholder conn, deadlines unsupported\n  }\n  return err\n}","handlingStrategy":"validation","validationCode":"if fmt.Sprintf(\"%T\", conn) == \"*gost.nopConn\" {\n    return nil // skip deadline: unsupported on nop connections\n}","typeGuard":"func supportsDeadlines(c net.Conn) bool {\n    return fmt.Sprintf(\"%T\", c) != \"*gost.nopConn\"\n}","tryCatchPattern":"if err := conn.SetDeadline(t); err != nil {\n    var oe *net.OpError\n    if errors.As(err, &oe) && oe.Err.Error() == \"deadline not supported\" {\n        return nil\n    }\n    return err\n}","preventionTips":["Apply deadline logic only to real network connections","Centralize deadline setting in one wrapper that filters nop conns","Treat 'deadline not supported' as benign in generic net.Conn helpers"],"tags":["net-conn","deadline","nop","unsupported-operation"],"backgroundTag":"deadline-not-supported","analyzedSha":"a33fdbf4c98034f4bfeeaea9868909822b9c526d","analyzedAt":"2026-09-02T22:15:54.506Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}