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

scram-sha-256 authentication on the PostgreSQL side as a Clickhouse PostgreSQL engine results in Clickhouse errors and crashes #24516

Closed
F0XMa5t3r opened this issue May 26, 2021 · 2 comments · Fixed by #25906

Comments

@F0XMa5t3r
Copy link

Clickhouse version 21.5.5.12
PostgreSQL 13.2

All my attempts to use scram-sha-256 authentication on the PostgreSQL side end with the following errors and Clickhouse crashes:
2021.05.25 14:05:00.831300 [ 3291 ] {a1034aab-728f-445a-b6f9-7f242b972558} executeQuery: (from 127.0.0.1:32014, using production parser) CREATE DATABASE clickhouse ENGINE = PostgreSQL('192.168.235.25:5432','clickhouse','click house','ORA2.novalocal12');
2021.05.25 14:05:00.831557 [ 3291 ] {a1034aab-728f-445a-b6f9-7f242b972558} ContextAccess (default): Access granted: CREATE DATABASE ON clickhouse.*
2021.05.25 14:05:00.831631 [ 3291 ] {a1034aab-728f-445a-b6f9-7f242b972558} ContextAccess (default): Access granted: POSTGRES ON .
2021.05.25 14:05:00.831871 [ 3291 ] {a1034aab-728f-445a-b6f9-7f242b972558} PostgreSQLPoolWithFailover: Adding address host: 192.168.235.25, port: 5432 to connection pool
2021.05.25 14:05:00.831923 [ 3291 ] {a1034aab-728f-445a-b6f9-7f242b972558} PostgreSQLConnectionPool: New connection pool. Size: 16, blocks on empty pool: true
2021.05.25 14:05:00.846095 [ 3299 ] {} PostgreSQLConnection: New connection to 192.168.235.25:5432
2021.05.25 14:05:00.846300 [ 3291 ] {a1034aab-728f-445a-b6f9-7f242b972558} MemoryTracker: Peak memory usage (for query): 0.00 B.
2021.05.25 14:05:00.846613 [ 3291 ] {} TCPHandler: Processed in 0.015805277 sec.
2021.05.25 14:05:00.858308 [ 3280 ] {} BaseDaemon: Received signal 11
2021.05.25 14:05:00.858760 [ 3463 ] {} BaseDaemon: ########################################
2021.05.25 14:05:00.858906 [ 3463 ] {} BaseDaemon: (version 21.5.5.12 (official build), build id: DD2413BFFFAAA33DA8EAACC81543328CAEEC4A3E) (from thread 3299) (no query) Received signal Segmentation fault (11)
2021.05.25 14:05:00.859017 [ 3463 ] {} BaseDaemon: Address: 0x2000000000 Access: read. Address not mapped to object.
2021.05.25 14:05:00.859112 [ 3463 ] {} BaseDaemon: Stack trace: 0x13d7a3a5 0x13d567c8 0x13d54511 0x13d5d418 0x13d585a8 0xe99dfc8 0xe99d787 0xe99d9d8 0xe9a00ac 0xf056ea7 0xf05b015 0xef07880 0xef098d7 0xef0a652 0x87ddabf 0x87e1 6c3 0x7fc0851a6ea5 0x7fc084ecf9fd
2021.05.25 14:05:00.859282 [ 3463 ] {} BaseDaemon: 1. scram_HMAC_init @ 0x13d7a3a5 in ?
2021.05.25 14:05:00.859422 [ 3463 ] {} BaseDaemon: 2. pg_fe_scram_exchange @ 0x13d567c8 in /usr/bin/clickhouse
2021.05.25 14:05:00.859551 [ 3463 ] {} BaseDaemon: 3. pg_fe_sendauth @ 0x13d54511 in /usr/bin/clickhouse
2021.05.25 14:05:00.859650 [ 3463 ] {} BaseDaemon: 4. PQconnectPoll @ 0x13d5d418 in /usr/bin/clickhouse
2021.05.25 14:05:00.859707 [ 3463 ] {} BaseDaemon: 5. ? @ 0x13d585a8 in /usr/bin/clickhouse
2021.05.25 14:05:00.859839 [ 3463 ] {} BaseDaemon: 6. pqxx::connection::connection(char const*) @ 0xe99dfc8 in /usr/bin/clickhouse
2021.05.25 14:05:00.859911 [ 3463 ] {} BaseDaemon: 7. postgres::Connection::connectIfNeeded() @ 0xe99d787 in /usr/bin/clickhouse
2021.05.25 14:05:00.859975 [ 3463 ] {} BaseDaemon: 8. postgres::Connection::tryConnectIfNeeded() @ 0xe99d9d8 in /usr/bin/clickhouse
2021.05.25 14:05:00.860065 [ 3463 ] {} BaseDaemon: 9. postgres::PoolWithFailover::get() @ 0xe9a00ac in /usr/bin/clickhouse
2021.05.25 14:05:00.860149 [ 3463 ] {} BaseDaemon: 10. DB::DatabasePostgreSQL::fetchTablesList() const @ 0xf056ea7 in /usr/bin/clickhouse
2021.05.25 14:05:00.860217 [ 3463 ] {} BaseDaemon: 11. DB::DatabasePostgreSQL::removeOutdatedTables() @ 0xf05b015 in /usr/bin/clickhouse
2021.05.25 14:05:00.860349 [ 3463 ] {} BaseDaemon: 12. DB::BackgroundSchedulePoolTaskInfo::execute() @ 0xef07880 in /usr/bin/clickhouse
2021.05.25 14:05:00.860420 [ 3463 ] {} BaseDaemon: 13. DB::BackgroundSchedulePool::threadFunction() @ 0xef098d7 in /usr/bin/clickhouse
2021.05.25 14:05:00.860478 [ 3463 ] {} BaseDaemon: 14. ? @ 0xef0a652 in /usr/bin/clickhouse
2021.05.25 14:05:00.860553 [ 3463 ] {} BaseDaemon: 15. ThreadPoolImplstd::__1::thread::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0x87ddabf in /usr/bin/clickhouse
2021.05.25 14:05:00.860612 [ 3463 ] {} BaseDaemon: 16. ? @ 0x87e16c3 in /usr/bin/clickhouse
2021.05.25 14:05:00.860706 [ 3463 ] {} BaseDaemon: 17. start_thread @ 0x7ea5 in /usr/lib64/libpthread-2.17.so
2021.05.25 14:05:00.860785 [ 3463 ] {} BaseDaemon: 18. clone @ 0xfe9fd in /usr/lib64/libc-2.17.so
2021.05.25 14:05:01.123631 [ 3463 ] {} BaseDaemon: Checksum of the binary: 80031837E47C71EF32BBB4A0398E8552, integrity check passed.
2021.05.25 14:05:20.922096 [ 3274 ] {} Application: Child process was terminated by signal 11.

Authentication settings on the PostgreSQL side from a file pg_hba.conf:
host all clickhouse 192.168.235.25/32 scram-sha-256

The strange thing is that on the Internet it was not possible to find information on these errors and on the supported authentication methods, their settings for the Clickhouse PostgreSQL engine.

When setting pg_hba.conf:
host all clickhouse 192.168.235.25/32 trust
or
host all clickhouse 192.168.235.25/32 password
Clickhouse is working fine.
clickhouse-server.log

@F0XMa5t3r F0XMa5t3r added the bug Confirmed user-visible misbehaviour in official release label May 26, 2021
@kssenii kssenii added unfinished code and removed bug Confirmed user-visible misbehaviour in official release labels May 26, 2021
@kssenii kssenii self-assigned this May 27, 2021
@F0XMa5t3r
Copy link
Author

Colleagues, is there any progress in resolving this issue?

@kssenii
Copy link
Member

kssenii commented Jun 30, 2021

Sorry, it was stopped. I'll continue with it this week.

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

Successfully merging a pull request may close this issue.

3 participants