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

MySQL socket factory: Respect timeouts to prevent indefinite blocking #154

Closed
x2zh opened this issue Mar 7, 2024 · 2 comments
Closed

MySQL socket factory: Respect timeouts to prevent indefinite blocking #154

x2zh opened this issue Mar 7, 2024 · 2 comments
Assignees
Labels
bug The issue describes a bug in the code merged A fix has been merged to main verify The issue is considered fixed/done, and reassigned to the originator to verify.
Milestone

Comments

@x2zh
Copy link

x2zh commented Mar 7, 2024

Describe the bug
In the org.newsclub.net.mysql.AFUNIXDatabaseSocketFactoryCJ#connect method, the timeout parameter is not set when using the AFUNIXSocket#connectTo method. The default timeout is 0. If there are some abnormalities in the socket, the connectTo operation may be permanently blocked.

public <T extends Closeable> T connect(String hostname, int portNumber, PropertySet props, int loginTimeout) throws IOException {
        ..........
        this.rawSocket = AFUNIXSocket.connectTo(new AFUNIXSocketAddress(socketFile));
       ...........
    }

Expected behavior
Set the timeout correctly to prevent permanent blockage.

kohlschuetter added a commit that referenced this issue Mar 7, 2024
AFUNIXDatabaseSocketFactoryCJ.connect takes a "loginTimeout" parameter,
and the system properties may specify a "connectTimeout".

While connecting to AF_UNIX sockets appears to not block in the regular
case, let's assume there's a corner case where respecting these values
makes sense.

Follow standard Mysql connector behavior and use these two timeouts to
determine the connect timeout for our unix domain sockets.

#154
@kohlschuetter
Copy link
Member

Thanks for reporting, @x2zh!

Please verify with the latest code and let me know if that fixes your issue.

@kohlschuetter kohlschuetter added bug The issue describes a bug in the code verify The issue is considered fixed/done, and reassigned to the originator to verify. merged A fix has been merged to main labels Mar 7, 2024
@kohlschuetter kohlschuetter added this to the 2.9.1 milestone Mar 7, 2024
@kohlschuetter kohlschuetter changed the title Improperly set timeout may result in permanent blockage MySQL socket factory: Respect timeouts to prevent indefinite blocking Mar 7, 2024
@kohlschuetter
Copy link
Member

2.9.1 has been released, please verify. Thanks again for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue describes a bug in the code merged A fix has been merged to main verify The issue is considered fixed/done, and reassigned to the originator to verify.
Projects
None yet
Development

No branches or pull requests

2 participants