Skip to content

Instantly share code, notes, and snippets.

@azat
Created November 7, 2025 08:18
Show Gist options
  • Select an option

  • Save azat/78ab100c053bd7e01fd0e97c7e5b003a to your computer and use it in GitHub Desktop.

Select an option

Save azat/78ab100c053bd7e01fd0e97c7e5b003a to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import clickhouse_driver
c = clickhouse_driver.Client(host='127.1')
c.execute('select * from numbers(100000)', settings={'send_profile_events': 0})
c.execute('select * from numbers(100000)', settings={'send_profile_events': 1})
c.execute('insert into function null() values', ((x, ) for x in range(5)), settings={'send_profile_events': 1})
# this is broken
c.execute('insert into function null() values', ((x, ) for x in range(5)), settings={'send_profile_events': 0, 'receive_timeout': 5})
@azat
Copy link
Author

azat commented Nov 7, 2025

Traceback (most recent call last):
  File "/tmp/test.py", line 11, in <module>
    c.execute('insert into function null() values', ((x, ) for x in range(5)), settings={'send_profile_events': 0, 'receive_timeout': 5})
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/azat/.local/lib/python3.13/site-packages/clickhouse_driver/client.py", line 376, in execute
    rv = self.process_insert_query(
        query, params, external_tables=external_tables,
        query_id=query_id, types_check=types_check,
        columnar=columnar
    )
  File "/home/azat/.local/lib/python3.13/site-packages/clickhouse_driver/client.py", line 607, in process_insert_query
    rv = self.send_data(sample_block, data,
                        types_check=types_check, columnar=columnar)
  File "/home/azat/.local/lib/python3.13/site-packages/clickhouse_driver/client.py", line 665, in send_data
    self.receive_profile_events()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/azat/.local/lib/python3.13/site-packages/clickhouse_driver/client.py", line 747, in receive_profile_events
    raise packet.exception
clickhouse_driver.errors.ServerException: Code: 209.
DB::NetException. DB::NetException: Timeout exceeded while receiving data from client. Waited for 10 seconds, timeout is 5 seconds.. Stack trace:

0. /src/ch/clickhouse/contrib/llvm-project/libcxx/include/__exception/exception.h:113: Poco::Exception::Exception(String const&, int) @ 0x000000001e131a79
1. /src/ch/clickhouse/src/Common/Exception.cpp:129: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x000000000fcebce2
2. /src/ch/clickhouse/src/Common/Exception.h:123: DB::Exception::Exception(String&&, int, String, bool) @ 0x0000000008d66051
3. /src/ch/clickhouse/src/Common/NetException.h:26: DB::NetException::NetException<unsigned long&, int>(int, FormatStringHelperImpl<std::type_identity<unsigned long&>::type, std::type_identity<int>::type>, unsigned long&, int&&) @ 0x000000001900cb9c
4. /src/ch/clickhouse/src/Server/TCPHandler.cpp:1071: DB::TCPHandler::receivePacketsExpectData(DB::QueryState&) @ 0x0000000019001e6d
5. /src/ch/clickhouse/src/Server/TCPHandler.cpp:1049: DB::TCPHandler::processInsertQuery(DB::QueryState&) @ 0x0000000018ff8ed3
6. /src/ch/clickhouse/src/Server/TCPHandler.cpp:756: DB::TCPHandler::runImpl() @ 0x0000000018fece32
7. /src/ch/clickhouse/src/Server/TCPHandler.cpp:2848: DB::TCPHandler::run() @ 0x000000001900a2dc
8. /src/ch/clickhouse/base/poco/Net/src/TCPServerConnection.cpp:40: Poco::Net::TCPServerConnection::start() @ 0x000000001e1edd8c
9. /src/ch/clickhouse/base/poco/Net/src/TCPServerDispatcher.cpp:115: Poco::Net::TCPServerDispatcher::run() @ 0x000000001e1ee37e
10. /src/ch/clickhouse/base/poco/Foundation/src/ThreadPool.cpp:205: Poco::PooledThread::run() @ 0x000000001e18c77f
11. /src/ch/clickhouse/base/poco/Foundation/src/Thread_POSIX.cpp:341: Poco::ThreadImpl::runnableEntry(void*) @ 0x000000001e189c8f
12. /usr/src/debug/glibc/glibc/nptl/pthread_create.c:448: start_thread @ 0x00000000000969cb
13. ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78: __GI___clone3 @ 0x000000000011aa0c

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