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

jdbc url set socket_timeout parameters is useless #1822

Open
Jiangnewtown opened this issue Sep 12, 2024 · 9 comments
Open

jdbc url set socket_timeout parameters is useless #1822

Jiangnewtown opened this issue Sep 12, 2024 · 9 comments
Labels

Comments

@Jiangnewtown
Copy link

I want to use DBeaver to connect to ClickHouse using the JDBC HTTP interface. However, the session timeout is 30 seconds. I tried adding socket_timeout=300000 to the URL settings, but it was ineffective.

I also attempted to modify the JDBC driver settings to forcibly pass the socket_timeout=300000 parameter in the HTTP URI, but an error occurred, indicating that the server does not support this parameter. Additionally, I tried changing the socket_timeout value directly in the driver settings, but it had no effect.

image

My question is, is there a way to increase the session timeout time while using DBeaver or DbVisualizer to execute a SQL query? Specifically, how can I specify parameters during the connection to extend the session timeout?

I am not sure if this is a bug. I have seen others mention on URL that this approach works, but it does not work for me with the latest JDBC driver.

@chernser chernser added question and removed bug labels Sep 13, 2024
@chernser
Copy link
Contributor

Good day, @Jiangnewtown!
There is a dedicated property:

    SESSION_TIMEOUT("session_timeout", 0,
            "Session timeout in seconds. 0 or negative number means same as server default."),

Would you please describe what error do you get?
Do you have a stack trace?

I would like to understand what timeout actually happens.

Thanks!

@chernser
Copy link
Contributor

@Jiangnewtown did it help?

@Jiangnewtown
Copy link
Author

Jiangnewtown commented Sep 28, 2024

I will try it tomorrow,Thanks a lot. @chernser

@Jiangnewtown
Copy link
Author

I tried modifying the driver configuration in Dbeaver to include the session_timeout parameter in the request URL, but it had no effect. I still cannot change the disconnection time of this HTTP connection.
image

I used Wireshark to capture packets and saw that this connection disconnects after 30 seconds. The session_timeout I set did not take effect.
image

@chernser
Copy link
Contributor

@Jiangnewtown
session timeout is in seconds - so your value in your example is too high, I think.

session_timeout | Number of seconds of inactivity before the identified by the session id will timeout and no longer be considered valid. Defaults to 60 seconds.

also you may try connection_ttl (time in ms) - value like 10000 is 10 seconds

@Jiangnewtown
Copy link
Author

when I set the session_timeout to a lower value,the session timeout also not changed,I guess it may a bug from clickhouse server or clickhouse does not support this feature,
connection_ttl was not support @chernser
image

@chernser
Copy link
Contributor

@Jiangnewtown that is strange that parameter is not working - I will look into it. It should be a client side parameter only.

What is your desired result? Do you want to reduce life of a connection or do you want to make it longer? I just trying to find a solution for your problem now.

Thanks!

@Jiangnewtown
Copy link
Author

@chernser I want to make the connection longer, I tried a lot of ways but did not find a solution.

Thanks very much !

@chernser
Copy link
Contributor

chernser commented Oct 3, 2024

@Jiangnewtown
Connection mostly controlled on server side. As I remember it is between 10 and 30 seconds.
This server configuration https://clickhouse.com/docs/en/operations/server-configuration-parameters/settings#keep-alive-timeout might help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants