Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The AF Socket status is abnormal. #163

Open
guxiaoxie opened this issue Dec 11, 2024 · 1 comment
Open

The AF Socket status is abnormal. #163

guxiaoxie opened this issue Dec 11, 2024 · 1 comment
Assignees
Labels
information needed More information is required

Comments

@guxiaoxie
Copy link

Describe the bug
I encountered a strange phenomenon about a uds-type client socket object exception created using junixsocket.

To Reproduce
Steps to reproduce the behavior:

  1. I make one uds Socket like this:
 public Socket createSocket() throws IOException, JedisConnectionException {
            // udsPath is sock file path ,and is not empty
            AFUNIXSocketFactory.FactoryArg factoryArg = new AFUNIXSocketFactory.FactoryArg(this.udsPath);
            Socket socket = factoryArg.createSocket();
            if (this.socketTimeout.get() > 0) {
                socket.setSoTimeout(this.socketTimeout.get());
            }
            socket.connect(new InetSocketAddress("localhost", 0));
            return socket;
    }

Expected behavior
After the Socket object invokes the connect method for connection, several common methods of the Socket interface are invoked. For example, socket.isBound() returns true, socket.isClosed() returns false, and socket.isConnected() returns true. The socket.isInputShutdown() method returns false, and the socket.isOutputShutdown() method returns false.
However, after a short period of time, several methods of the socket object will return different values: socket.isBound() returns false, socket.isConnected() returns false, socket.isInputShutdown() and socket.isOutputShutdown() both return true, but the socket.isClose() method returns false.

This exception occurs in the created socket for a short period of time.

I suspect that the UDS Socket occupies some Linux system resources. When resources are insufficient, Linux releases the resources of the UDS Socket.

Notes
Add any other context about the problem here. Please link/attach any source code that is useful to diagnose the issue.
Version: junixsocket-2.6.2
Java Version:1.8

@kohlschuetter
Copy link
Member

Thanks for reporting, @guxiaoxie !

2.6.2 is very outdated. Before investigating this deeper, please retry with the latest version, junixsocket 2.10.1.
Please also include some sort of unit test / reproduction code, if possible.

@kohlschuetter kohlschuetter added the information needed More information is required label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
information needed More information is required
Projects
None yet
Development

No branches or pull requests

2 participants