Skip to content

HikariCP timeout with com.clickhouse.jdbc.ClickHouseDataSource #1214

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

Closed
wzisheng opened this issue Jan 31, 2023 · 5 comments · Fixed by #1217
Closed

HikariCP timeout with com.clickhouse.jdbc.ClickHouseDataSource #1214

wzisheng opened this issue Jan 31, 2023 · 5 comments · Fixed by #1217
Labels

Comments

@wzisheng
Copy link

clickhouse-jdbc 0.3.2 with HikariCP 4.0.3

if we use com.clickhouse.jdbc.ClickHouseDataSource, and convert to HikariCP datasource, then we got
image

while ru.yandex.clickhouse.clickhousedatasource works fine.
BTW, we use https

@zhicwu
Copy link
Contributor

zhicwu commented Jan 31, 2023

Hi @wzisheng, I didn't see JDBC driver show up in above stack trace. Could you elaborate? Would be great if you can provide minimal code for reproducing the issue.

@wzisheng
Copy link
Author

wzisheng commented Feb 1, 2023

@zhicwu here it is...

private static DataSource convertToHikari(final DataSource dataSource) {
HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setConnectionTimeout(xxx);
hikariConfig.setMaximumPoolSize(20);
hikariConfig.setMaxLifetime(xxx);
hikariConfig.setDataSource(dataSource);
return new HikariDataSource(hikariConfig);
}

properties.put("ssl", "true");
properties.put("sslmode", "NONE");
DataSource dataSource = convertToHikari(new ClickHouseDataSource(url, properties));
while(10) {
try (Connection connection = dastaSource.getConnection(); // --- here will get timeout exception
Statement statement = connection.createStatement();
ResultSet result = statement.executeQuery(sql)) {
int count = 0;
if (result.next()) {
count = result.getInt("aa");
}
System.out.println(count);
} catch (Exception e) {
e.printStackTrace();
}
}

@zhicwu zhicwu linked a pull request Feb 1, 2023 that will close this issue
3 tasks
@zhicwu
Copy link
Contributor

zhicwu commented Feb 1, 2023

Not able to reproduce. Please make sure the url is valid and server is reachable from client.

Anyway, I updated examples by adding usePooledConnection() which works well.

@zhicwu zhicwu added the question label Feb 1, 2023
@wzisheng
Copy link
Author

wzisheng commented Feb 3, 2023

Not able to reproduce. Please make sure the url is valid and server is reachable from client.

Anyway, I updated examples by adding usePooledConnection() which works well.

seems usePooledConnection() only get one connection, which in mine the first time it works fine . Only if the 2nd or 3/4th time it will produce..
@zhicwu

@zhicwu
Copy link
Contributor

zhicwu commented Feb 3, 2023

Only if the 2nd or 3/4th time it will produce..

Tried a loop for 1000 times(pool size=20) and still not able to reproduce. Please feel free to reopen the issue if you're certain it's caused by the driver.

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

Successfully merging a pull request may close this issue.

2 participants