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

Fix "Port 9000 is for clickhouse-client program" error in ClickHouse tests #10752

Closed
ebyhr opened this issue Jan 24, 2022 · 5 comments
Closed
Labels
bug Something isn't working test

Comments

@ebyhr
Copy link
Member

ebyhr commented Jan 24, 2022

java.lang.RuntimeException: ClickHouse exception, code: 9000, host: localhost, port: 49162; Port 9000 is for clickhouse-client program.
You must use port 8123 for HTTP.

	at io.trino.testing.AbstractTestingTrinoClient.execute(AbstractTestingTrinoClient.java:122)
	at io.trino.testing.DistributedQueryRunner.execute(DistributedQueryRunner.java:505)
	at io.trino.testing.QueryAssertions.assertQueryFails(QueryAssertions.java:290)
	at io.trino.testing.AbstractTestQueryFramework.assertQueryFails(AbstractTestQueryFramework.java:270)
	at io.trino.testing.BaseConnectorSmokeTest.testView(BaseConnectorSmokeTest.java:400)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:645)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
	Suppressed: java.lang.Exception: SQL: CREATE VIEW nation_v AS SELECT * FROM nation
		at io.trino.testing.DistributedQueryRunner.execute(DistributedQueryRunner.java:508)
		... 16 more
	Suppressed: java.lang.Exception: Query: CREATE VIEW nation_v AS SELECT * FROM nation
		at io.trino.testing.QueryAssertions.assertQueryFails(QueryAssertions.java:294)
		... 15 more
Caused by: io.trino.spi.TrinoException: ClickHouse exception, code: 9000, host: localhost, port: 49162; Port 9000 is for clickhouse-client program.
You must use port 8123 for HTTP.

	at io.trino.plugin.jdbc.BaseJdbcClient.getTableHandle(BaseJdbcClient.java:214)
	at io.trino.plugin.jdbc.ForwardingJdbcClient.getTableHandle(ForwardingJdbcClient.java:83)
	at io.trino.plugin.jdbc.jmx.StatisticsAwareJdbcClient.lambda$getTableHandle$3(StatisticsAwareJdbcClient.java:103)
	at io.trino.plugin.jdbc.jmx.JdbcApiStats.wrap(JdbcApiStats.java:35)
	at io.trino.plugin.jdbc.jmx.StatisticsAwareJdbcClient.getTableHandle(StatisticsAwareJdbcClient.java:103)
	at io.trino.plugin.jdbc.CachingJdbcClient.lambda$getTableHandle$4(CachingJdbcClient.java:281)
	at io.trino.plugin.base.cache.EvictableCache.get(EvictableCache.java:109)
	at io.trino.plugin.jdbc.CachingJdbcClient.get(CachingJdbcClient.java:679)
	at io.trino.plugin.jdbc.CachingJdbcClient.getTableHandle(CachingJdbcClient.java:281)
	at io.trino.plugin.jdbc.CachingJdbcClient.lambda$getTableHandle$4(CachingJdbcClient.java:281)
	at io.trino.plugin.base.cache.EvictableCache.get(EvictableCache.java:109)
	at io.trino.plugin.jdbc.CachingJdbcClient.get(CachingJdbcClient.java:679)
	at io.trino.plugin.jdbc.CachingJdbcClient.getTableHandle(CachingJdbcClient.java:281)
	at io.trino.plugin.jdbc.DefaultJdbcMetadata.getTableHandle(DefaultJdbcMetadata.java:118)
	at io.trino.plugin.jdbc.DefaultJdbcMetadata.getTableHandle(DefaultJdbcMetadata.java:87)
	at io.trino.plugin.base.classloader.ClassLoaderSafeConnectorMetadata.getTableHandle(ClassLoaderSafeConnectorMetadata.java:182)
	at io.trino.metadata.MetadataManager.lambda$getTableHandle$4(MetadataManager.java:329)
	at java.base/java.util.Optional.flatMap(Optional.java:294)
	at io.trino.metadata.MetadataManager.getTableHandle(MetadataManager.java:309)
	at io.trino.metadata.MetadataManager.getTableHandle(MetadataManager.java:296)
	at io.trino.execution.CreateViewTask.execute(CreateViewTask.java:89)
	at io.trino.execution.CreateViewTask.execute(CreateViewTask.java:46)
	at io.trino.execution.DataDefinitionExecution.start(DataDefinitionExecution.java:158)
	at io.trino.execution.SqlQueryManager.createQuery(SqlQueryManager.java:243)
	at io.trino.dispatcher.LocalDispatchQuery.lambda$startExecution$7(LocalDispatchQuery.java:143)
	at io.trino.$gen.Trino_testversion____20220124_041801_799.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: ru.yandex.clickhouse.except.ClickHouseException: ClickHouse exception, code: 9000, host: localhost, port: 49162; Port 9000 is for clickhouse-client program.
You must use port 8123 for HTTP.

	at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:60)
	at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:30)
	at ru.yandex.clickhouse.ClickHouseStatementImpl.checkForErrorAndThrow(ClickHouseStatementImpl.java:1083)
	at ru.yandex.clickhouse.ClickHouseStatementImpl.getInputStream(ClickHouseStatementImpl.java:770)
	at ru.yandex.clickhouse.ClickHouseStatementImpl.getLastInputStream(ClickHouseStatementImpl.java:693)
	at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:341)
	at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:326)
	at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:320)
	at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:314)
	at ru.yandex.clickhouse.ClickHouseConnectionImpl.initConnection(ClickHouseConnectionImpl.java:95)
	at ru.yandex.clickhouse.ClickHouseConnectionImpl.<init>(ClickHouseConnectionImpl.java:79)
	at ru.yandex.clickhouse.ClickHouseDriver.connect(ClickHouseDriver.java:65)
	at ru.yandex.clickhouse.ClickHouseDriver.connect(ClickHouseDriver.java:57)
	at ru.yandex.clickhouse.ClickHouseDriver.connect(ClickHouseDriver.java:36)
	at io.trino.plugin.jdbc.DriverConnectionFactory.openConnection(DriverConnectionFactory.java:65)
	at io.trino.plugin.clickhouse.ClickHouseConnectionFactory$1.<init>(ClickHouseConnectionFactory.java:43)
	at io.trino.plugin.clickhouse.ClickHouseConnectionFactory.openConnection(ClickHouseConnectionFactory.java:41)
	at io.trino.plugin.jdbc.jmx.StatisticsAwareConnectionFactory.lambda$openConnection$0(StatisticsAwareConnectionFactory.java:42)
	at io.trino.plugin.jdbc.jmx.JdbcApiStats.wrap(JdbcApiStats.java:35)
	at io.trino.plugin.jdbc.jmx.StatisticsAwareConnectionFactory.openConnection(StatisticsAwareConnectionFactory.java:42)
	at io.trino.plugin.jdbc.LazyConnectionFactory.lambda$openConnection$0(LazyConnectionFactory.java:45)
	at io.trino.plugin.jdbc.LazyConnectionFactory$LazyConnection.getDelegate(LazyConnectionFactory.java:76)
	at io.trino.plugin.jdbc.ForwardingConnection.getMetaData(ForwardingConnection.java:117)
	at io.trino.plugin.clickhouse.ClickHouseClient.getTables(ClickHouseClient.java:349)
	at io.trino.plugin.jdbc.BaseJdbcClient.getTableHandle(BaseJdbcClient.java:199)
	... 28 more
Caused by: java.lang.Throwable: Port 9000 is for clickhouse-client program.
You must use port 8123 for HTTP.

	at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:55)
	... 52 more
@ebyhr ebyhr changed the title ClickHouse Fix "Port 9000 is for clickhouse-client program" error in ClickHouse tests Jan 24, 2022
@ebyhr ebyhr added bug Something isn't working test labels Jan 24, 2022
@ebyhr
Copy link
Member Author

ebyhr commented Jan 25, 2022

@phd3
Copy link
Member

phd3 commented Jan 26, 2022

@hashhar
Copy link
Member

hashhar commented Jan 31, 2022

@ebyhr Have we already tried just including the http driver using a classifier for the clickhouse driver? Maybe multiple drivers are registering themselves and causing issues depending on which one wins?

<classifier>http</classifier>
    <exclusions>
        <exclusion>
            <groupId>*</groupId>
            <artifactId>*</artifactId>
        </exclusion>
    </exclusions>

@ebyhr
Copy link
Member Author

ebyhr commented Feb 1, 2022

@hashhar As @zhicwu already commented in #10863 (comment), it seems the cause is http client. So, such exclusion won't resolve the issue in my guess.

@ebyhr
Copy link
Member Author

ebyhr commented Mar 2, 2022

I suppose this flaky test was resolved by recent ClickHouse library upgrade and removing old version support. Let's reopen or create a new issue if reproduced.

@ebyhr ebyhr closed this as completed Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working test
Development

No branches or pull requests

3 participants