Skip to content

Dial timeout error still is not redirectable #3799

@vladisa88

Description

@vladisa88

After we fix #3786

I think that we haven't finished with this bug yet. I've updated lib version, decided to re-check and noticed that dial tcp timeouts still not redirectable. So I think that problem is here

# internal/pool/pool.go
attemptCtx, cancel = context.WithTimeout(ctx, p.cfg.DialTimeout)

We use context timeout here. So when dial timeout is over *net.OpError{Op: "dial"} is wrapped inside ContextDeadlineExceeded, so in shouldRetry this condition is true

if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
	return false
}

I suppose that we should move new condition before this check

var opErr *net.OpError
if errors.As(err, &opErr) && opErr.Op == "dial" {
    return true 
}

if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
	return false
}

@ndyakov Hi! I commented in original issue #3799 (comment) so we can reopen it or discuss it here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions