Details
-
Bug
-
Resolution: Fixed
-
Major
-
None
-
None
-
2
-
SDK08: SDK3.5, 0xD, FtrNA, PS
Description
When calling cluster::connect, it invokes the constructor of couchbase::cluster from the callback of core.open, which is running on an IO thread: https://github.com/couchbaselabs/couchbase-cxx-client/blob/main/core/impl/cluster.cxx#L381
The constructor of couchbase::cluster, then invokes the constructor of
couchbase::core::transactions::transactions, which attempts to open the bucket of the custom metadata collection, and blocks until the bucket has been opened: https://github.com/couchbaselabs/couchbase-cxx-client/blob/main/core/transactions/transactions.cxx#L48-L66
As open_bucket here is called from within an IO thread (callback of core.open) it will hang if only 1 IO thread is configured, as there are no available IO threads (as the only available IO thread is occupied by the callback of core.open which will never return as that requires the transactions object to be constructed)
To reproduce:
int
|
main()
|
{
|
couchbase::core::logger::create_console_logger();
|
couchbase::core::logger::set_log_levels(couchbase::core::logger::level::trace);
|
|
asio::io_context io;
|
auto guard = asio::make_work_guard(io);
|
std::thread io_thread([&io]() { io.run(); });
|
|
auto options = couchbase::cluster_options("Administrator", "password"); |
options.transactions().metadata_collection(couchbase::transactions::transaction_keyspace{ "default", couchbase::scope::default_name, couchbase::collection::default_name }); |
auto [cluster, ec] = couchbase::cluster::connect(io, "couchbase://127.0.0.1", options).get(); |
|
cluster.close();
|
guard.reset();
|
io_thread.join();
|
|
return 0; |
}
|
Attachments
Issue Links
- causes
-
CXXCBC-438 Performer crashes during Write Write tests
- Closed
For Gerrit Dashboard: CXXCBC-462 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
207043,2 | PYCBC-1565: Update C++ core to include changes from CXXCBC-462 | master | couchbase-python-client | Status: MERGED | +2 | +1 |
207104,3 | JSCBC-1241: Update C++ core to include changes from CXXCBC-462 | master | couchnode | Status: MERGED | +2 | +1 |