Details
-
Bug
-
Resolution: Fixed
-
Major
-
1.0.0-beta.2
-
None
-
None
-
1
-
SDK35
Description
Executing a prepared statement hangs and never times out. The last log line is.
[2022-04-26 11:41:40.367] [40413,4763045] [trace] 0ms, [14bdb9c6-95bf-4d65-bfe5-d87a651b50d9/8d8e0e67-01dd-4025-ec15-e6c484902474] <18.225.37.29:8093> HTTP request: query, method=POST, path="/query/service", client_context_id="a9d04a8f-b749-4aed-1530-08fac97cc933", timeout=75000ms
|
The retry of the query after fetching the plan causes the current_response_mutex_ to be locked at http_session.hxx:310 while it is already locked at http_session.hxx:458
thread #2
|
frame #0: 0x00007fff6e125062 libsystem_kernel.dylib`__psynch_mutexwait + 10
|
frame #1: 0x00007fff6e1e3917 libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_wait + 83
|
frame #2: 0x00007fff6e1e1937 libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_slow + 222
|
frame #3: 0x00000001043aabf9 libc++.1.0.dylib`std::__1::mutex::lock() + 9
|
frame #4: 0x0000000103af629c test_integration_query`void couchbase::io::http_session::write_and_subscribe<couchbase::operations::http_command<couchbase::operations::query_request>::send()::'lambda'(std::__1::error_code, couchbase::io::http_response&&)>(couchbase::io::http_request&, couchbase::operations::query_request&&) [inlined] std::__1::scoped_lock<std::__1::mutex>::scoped_lock(this=<unavailable>, __m=0x00007ff4aa00b360) at mutex:499:27
|
frame #5: 0x0000000103af6294 test_integration_query`void couchbase::io::http_session::write_and_subscribe<couchbase::operations::http_command<couchbase::operations::query_request>::send()::'lambda'(std::__1::error_code, couchbase::io::http_response&&)>(couchbase::io::http_request&, couchbase::operations::query_request&&) [inlined] std::__1::scoped_lock<std::__1::mutex>::scoped_lock(this=<unavailable>, __m=0x00007ff4aa00b360) at mutex:499
|
frame #6: 0x0000000103af6294 test_integration_query`void couchbase::io::http_session::write_and_subscribe<couchbase::operations::http_command<couchbase::operations::query_request>::send()::'lambda'(std::__1::error_code, couchbase::io::http_response&&)>(this=0x00007ff4aa00b020, request=0x00007ff4a880d550, handler=<unavailable>) at http_session.hxx:310
|
frame #7: 0x0000000103af5ec6 test_integration_query`couchbase::operations::http_command<couchbase::operations::query_request>::send(this=0x00007ff4a880d220) at http_command.hxx:139:19
|
frame #8: 0x0000000103b05932 test_integration_query`couchbase::operations::http_command<couchbase::operations::query_request>::send(this=0x0000700000a8e888, ec=<unavailable>, msg=0x0000700000a8e8b0)::'lambda'(std::__1::error_code, couchbase::io::http_response&&)::operator()(std::__1::error_code, couchbase::io::http_response&&) const at http_command.hxx:168:25
|
frame #9: 0x0000000103af0116 test_integration_query`couchbase::io::http_session::do_read()::'lambda'(std::__1::error_code, unsigned long)::operator()(std::__1::error_code, unsigned long) const [inlined] std::__1::__function::__value_func<void (std::__1::error_code, couchbase::io::http_response&&)>::operator(this=<unavailable>, __args=<unavailable>, __args=<unavailable>)(std::__1::error_code&&, couchbase::io::http_response&&) const at functional:1880:16
|
frame #10: 0x0000000103af00f6 test_integration_query`couchbase::io::http_session::do_read()::'lambda'(std::__1::error_code, unsigned long)::operator()(std::__1::error_code, unsigned long) const [inlined] std::__1::function<void (std::__1::error_code, couchbase::io::http_response&&)>::operator(this=<unavailable>, __arg=(__val_ = 0, __cat_ = 0x00000001043daa98), __arg=<unavailable>)(std::__1::error_code, couchbase::io::http_response&&) const at functional:2555
|
frame #11: 0x0000000103af00f6 test_integration_query`couchbase::io::http_session::do_read(this=0x0000700000a8e9b8, ec=(__val_ = 0, __cat_ = 0x0000000103cdecc0), bytes_transferred=<unavailable>)::'lambda'(std::__1::error_code, unsigned long)::operator()(std::__1::error_code, unsigned long) const at http_session.hxx:458
|
Repro (server version < 6.5)
TEST_CASE("integration: prepared query", "[integration]")
|
{
|
test::utils::integration_test_guard integration;
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
|
auto key = test::utils::uniq_id("foo");
|
tao::json::value value = {
|
{ "a", 1.0 },
|
{ "b", 2.0 },
|
};
|
auto json = couchbase::utils::json::generate(value);
|
|
couchbase::mutation_token mutation_token;
|
|
{
|
couchbase::document_id id{ integration.ctx.bucket, "_default", "_default", key };
|
couchbase::operations::insert_request req{ id, json };
|
auto resp = test::utils::execute(integration.cluster, req);
|
REQUIRE_FALSE(resp.ctx.ec);
|
mutation_token = resp.token;
|
}
|
|
{
|
couchbase::operations::query_request req{ fmt::format(
|
R"(SELECT a, b FROM {} WHERE META().id = "{}")", integration.ctx.bucket, key) };
|
req.mutation_state = { mutation_token };
|
req.adhoc = false;
|
auto resp = test::utils::execute(integration.cluster, req);
|
REQUIRE_FALSE(resp.ctx.ec);
|
REQUIRE(resp.rows.size() == 1);
|
REQUIRE(value == couchbase::utils::json::parse(resp.rows[0]));
|
}
|
}
|