Skip to content

Make leafNode..dialTimeout configurable #8426

Description

@roeschter

Proposed change

Note that >1000ms packet roundtrip makes leaf node connections run into timeouts.

--- Claude analysis ----

Leaf node remotes dial with DEFAULT_ROUTE_DIAL = 1 * time.Second (server/const.go:156, used at server/leafnode.go:796 → natsDialTimeout, which is a plain net.Dialer{Timeout: 1s}). The LeafNodeOpts.dialTimeout override field is unexported (server/opts.go:234) — settable only in tests, not via config. With packet delay >1000ms, the SYN-ACK can't come back within 1s, so net.Dial always fails with i/o timeout. The leaf will loop forever logging Error trying to connect as leafnode to remote server ... i/o timeout and never even reach the INFO/TLS stage. first_info_timeout (the guide's #1 recommendation) never comes into play because the read deadline is only set after dial succeeds (leafnode.go:1408).

Use case

For high latency low bandwidth connections a >1000ms

Contribution

Will provide fix in PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalEnhancement idea or proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions