{"record":{"id":"29da412efb612b46","repo":"amir20/dozzle","slug":"deadline-exceeded-v-with-w","errorCode":null,"errorMessage":"deadline exceeded: %v with %w","messagePattern":"deadline exceeded: (.+?) with %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/agent/client.go","lineNumber":125,"sourceCode":"func rpcErrToErr(err error) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\n\tstatus, ok := status.FromError(err)\n\tif !ok {\n\t\treturn err\n\t}\n\n\tif status.Code() == codes.Unknown && status.Message() == \"EOF\" {\n\t\treturn fmt.Errorf(\"EOF error while converting gRPC to error: %w\", io.EOF)\n\t}\n\n\tswitch status.Code() {\n\tcase codes.Canceled:\n\t\treturn fmt.Errorf(\"canceled: %v with %w\", status.Message(), context.Canceled)\n\tcase codes.DeadlineExceeded:\n\t\treturn fmt.Errorf(\"deadline exceeded: %v with %w\", status.Message(), context.DeadlineExceeded)\n\tcase codes.Unknown:\n\t\treturn fmt.Errorf(\"unknown error: %v with %w\", status.Message(), err)\n\tcase codes.OK:\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown code: %v with %w\", status.Code(), err)\n\t}\n}\n\nfunc (c *Client) LogsBetweenDates(ctx context.Context, containerID string, since time.Time, until time.Time, std container.StdType) (<-chan *container.LogEvent, error) {\n\tstream, err := c.client.LogsBetweenDates(ctx, &pb.LogsBetweenDatesRequest{\n\t\tContainerId: containerID,\n\t\tSince:       timestamppb.New(since),\n\t\tUntil:       timestamppb.New(until),\n\t\tStreamTypes: int32(std),\n\t})\n\n\tif err != nil {","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/amir20/dozzle/blob/d9463cbe21874e44ab79db6fa63e746ca7d22928/internal/agent/client.go#L107-L143","documentation":"rpcErrToErr maps gRPC status code DeadlineExceeded to \"deadline exceeded: %v with %w\", wrapping context.DeadlineExceeded. The RPC did not complete before its context deadline (or the gRPC keepalive/timeout window elapsed).","triggerScenarios":"Any agent RPC (streaming or unary) executed with a ctx whose deadline expired; keepalive Timeout (10s) elapsing without transport activity; slow Docker operations on a loaded host.","commonSituations":"Agent host under heavy I/O so log streams stall; network partition between server and agent node; setting an aggressive context.WithTimeout on log fetches; container stats streams stalling behind a slow disk.","solutions":["Retry the RPC with a fresh, longer deadline (errors.Is(err, context.DeadlineExceeded) makes it identifiable)","Increase the ctx timeout passed to streaming calls, or drop deadlines for long-lived streams","Check network latency/packet loss between Dozzle server and agent host","Verify the agent container is not resource-starved (CPU throttling, disk pressure) on the remote node"],"exampleFix":"// before\nctx, cancel := context.WithTimeout(ctx, 2*time.Second)\nstream, err := client.StreamContainerLogs(ctx, req)\n// after\nctx, cancel := context.WithTimeout(ctx, 30*time.Second)\nstream, err := client.StreamContainerLogs(ctx, req)\nif err != nil && errors.Is(err, context.DeadlineExceeded) {\n    // retry with backoff\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && errors.Is(err, context.DeadlineExceeded) {\n    time.Sleep(backoff)\n    retryWithLongerDeadline()\n    return\n}","preventionTips":["Use generous deadlines (or none) for long-lived streams; reserve short deadlines for unary calls","Check network latency between server and agent hosts during deployment","Alert on agent host resource pressure (CPU/disk) that slows RPC responses"],"tags":["go","grpc","timeout","network"],"backgroundTag":"request-timeout","analyzedSha":"d9463cbe21874e44ab79db6fa63e746ca7d22928","analyzedAt":"2026-09-07T10:08:55.855Z","contentChangedAt":"2026-09-07T10:08:55.855Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}