Repository navigation
Closed
Labels
comp-database-enginesDatabase engine implementations (e.g., Atomic/Replicated) and database-level behavior.flaky testflaky test found by CItestingSpecial issue with list of bugs found by CI
Description
Important: This issue was automatically generated and is used by CI for matching failures. DO NOT modify the body content. DO NOT remove labels.
Test name: test_drop_replica/test.py::test_drop_replica
Failure reason: Database test1 cannot be detached, because some tables are still in use
CI report: Integration tests (arm_binary, distributed plan, 4/4)
CIDB statistics: cidb
Test output:
File: test_drop_replica/test.py:161 - in test_drop_replica
node_1_1.query("DETACH DATABASE test{}".format(i))
File: helpers/cluster.py:4454 - in query
return self.client.query(
File: helpers/client.py:40 - in wrap
return func(self, *args, **kwargs)
File: helpers/client.py:80 - in query
).get_answer()
File: helpers/client.py:269 - in get_answer
raise QueryRuntimeException(
E helpers.client.QueryRuntimeException: Client failed! Return code: 219, stderr: Received exception from server (version 26.1.1):
E Code: 219. DB::Exception: Received from 172.16.4.6:9000. DB::Exception: Database test1 cannot be detached, because some tables are still in use. Retry later.. Stack trace:
E
E 0. ./ci/tmp/build/./base/poco/Foundation/src/Exception.cpp:28: Poco::Exception::Exception(String const&, int) @ 0x000000001e67ed38
E 1. ./ci/tmp/build/./src/Common/Exception.cpp:136: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x0000000010e68b0c
E 2. DB::Exception::Exception(String&&, int, String, bool) @ 0x000000000ab674d8
E 3. DB::Exception::Exception(PreformattedMessage&&, int) @ 0x000000000ab66f8c
E 4. DB::Exception::Exception<String>(int, FormatStringHelperImpl<std::type_identity<String>::type>, String&&) @ 0x000000000ab66bd8
E 5. ./ci/tmp/build/./src/Databases/DatabaseAtomic.cpp:504: DB::DatabaseAtomic::assertCanBeDetached(bool) @ 0x0000000015aff918
E 6. ./ci/tmp/build/./src/Interpreters/InterpreterDropQuery.cpp:624: DB::InterpreterDropQuery::executeToDatabaseImpl(DB::ASTDropQuery const&, std::shared_ptr<DB::IDatabase>&, std::vector<StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag>, std::allocator<StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag>>>&) @ 0x0000000016832f88
E 7. ./ci/tmp/build/./src/Interpreters/InterpreterDropQuery.cpp:368: DB::InterpreterDropQuery::executeToDatabase(DB::ASTDropQuery const&) @ 0x000000001682f664
E 8. ./ci/tmp/build/./src/Interpreters/InterpreterDropQuery.cpp:77: DB::InterpreterDropQuery::execute() @ 0x000000001682e64c
E 9. ./ci/tmp/build/./src/Interpreters/executeQuery.cpp:1748: DB::executeQueryImpl(char const*, char const*, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum, std::unique_ptr<DB::ReadBuffer, std::default_delete<DB::ReadBuffer>>&, std::shared_ptr<DB::IAST>&, std::shared_ptr<DB::ImplicitTransactionControlExecutor>, std::function<void ()>, DB::QueryResultDetails&) @ 0x0000000016ba5908
E 10. ./ci/tmp/build/./src/Interpreters/executeQuery.cpp:1972: DB::executeQuery(String const&, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum) @ 0x0000000016ba1b80
E 11. ./ci/tmp/build/./src/Server/TCPHandler.cpp:774: DB::TCPHandler::runImpl() @ 0x0000000019a2c560
E 12. ./ci/tmp/build/./src/Server/TCPHandler.cpp:2862: DB::TCPHandler::run() @ 0x0000000019a46244
E 13. ./ci/tmp/build/./base/poco/Net/src/TCPServerConnection.cpp:40: Poco::Net::TCPServerConnection::start() @ 0x000000001e74d9d8
E 14. ./ci/tmp/build/./base/poco/Net/src/TCPServerDispatcher.cpp:115: Poco::Net::TCPServerDispatcher::run() @ 0x000000001e74e098
E 15. ./ci/tmp/build/./base/poco/Foundation/src/ThreadPool.cpp:205: Poco::PooledThread::run() @ 0x000000001e6e0a98
E 16. ./base/poco/Foundation/src/Thread_POSIX.cpp:341: Poco::ThreadImpl::runnableEntry(void*) @ 0x000000001e6de034
E 17. ? @ 0x0000000000080398
E 18. ? @ 0x00000000000e9e9c
E . (DATABASE_NOT_EMPTY)
E (query: DETACH DATABASE test1)
Metadata
Metadata
Assignees
Labels
comp-database-enginesDatabase engine implementations (e.g., Atomic/Replicated) and database-level behavior.flaky testflaky test found by CItestingSpecial issue with list of bugs found by CI
Activity
alexey-milovidov commentedon Feb 28, 2026
Not relevant.
Wait for DETACH DATABASE to release tables in three integration tests
PedroTadim commentedon Sep 18, 2026
Seen here https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=120568&sha=latest&name_0=BackportPR @groeneai can you try to fix it and I review the PR
clickhouse-gh commentedon Sep 18, 2026
🎉 Crash classifier:
comp-database-engines(secondarycomp-testing, confidence medium).Flaky test_drop_replica: DETACH DATABASE fails with DATABASE_NOT_EMPTY ("some tables are still in use")
Type: handled error (not a crash)
The integration test
test_drop_replica/test.py::test_drop_replicaintermittently fails because aDETACH DATABASE test1 SYNCreturns error Code 219 (DATABASE_NOT_EMPTY) raised inDatabaseAtomic::assertCanBeDetached: "Database test1 cannot be detached, because some tables are still in use. Retry later." This is a handled query-level error (DATABASE_NOT_EMPTY), not a process crash. The alert is classified as a crash but the trace is an ordinary exception path (Poco::Exception -> DB::Exception thrown from assertCanBeDetached).groeneai commentedon Sep 18, 2026
@PedroTadim That 219 is already fixed on master, but not on the branch that run came from.
I fixed it in #114628 (merged 2026-08-13), which added
SYNCto theDETACH DATABASEcalls in this test. The run you linked isbackport/26.7/120356(base26.7), andtests/integration/test_drop_replica/test.pythere still has the pre-fix lines:DETACH DATABASElines intest_drop_replicamaster(L158, L160)DETACH DATABASE test SYNC,DETACH DATABASE test{} SYNC26.7(L158, L160)DETACH DATABASE test,DETACH DATABASE test{}26.3(L159, L161)DETACH DATABASE test,DETACH DATABASE test{}SYNCis the in-tree remedy for this exact error:InterpreterDropQuery::executeToDatabaseImplonly waits viadatabase->waitDetachedTableNotInUse(...)whenquery.syncis set (its own comment there readsAvoid "some tables are still in use" when sync mode is enabled), andDatabaseAtomic::assertCanBeDetached(true)throws 219 whiledetached_tablesis still non-empty.CIDB rows carrying
cannot be detached, because some tables are still in usefortest_drop_replica:26.7run you linked. 0 on master.So there is nothing left for me to change on master, and I will not hand-author a backport. Could you put
v26.7-must-backportandv26.3-must-backporton #114628? Both branches still carry the pre-fix lines, which is why this keeps surfacing in BackportPR runs.For completeness:
test_drop_replicadid fail once on the master line since the merge (2026-09-16), but attest.py:108withCode: 32, ATTEMPT_TO_READ_AFTER_EOF ... while receiving packet from 172.16.2.9:9000, and only on one refactor branch (remove-old-analyzer). That is a server going away mid-query, not this failure recurring, so I am not folding it into this issue.