Skip to content

Support connection timeouts on sockets #176

Description

@DanielBauman88

This may already work - I'm not familiar with this code yet.

However, when following through the connect path I don't see the socket timeout passed to the native code that actually creates the unix domain socket.

See here -

success = NativeUnixSocket.connect(ab, ab.limit(), fd, -2);

I only see the param used in the context of virtual threads.

The interface supports a connectionTimeout - but it doesn't seem to be respected - just passed down to the AFSocketImpl and then dropped.

Shouldn't it be doing something like: https://github.com/openjdk/jdk/blob/ca52afa38e47bf1c901d05a817fe76d440bff2bd/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java#L67

I guess it could be because connection hangs are somewhat esoteric and far less likely to occur for UDS. If that's the case, it could be helpful to add a comment on the param explaining what it does - which seems to be something that only applies when using virtual threads.

Apologies if I've missed the way it's actually used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementA request to enhance the current functionality

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions