Bug #116569 | Terminate called after throwing an instance of 'cdk::foundation::Error' | ||
---|---|---|---|
Submitted: | 6 Nov 2024 14:59 | Modified: | 24 Dec 2024 21:42 |
Reporter: | Val Doroshchuk | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / C++ | Severity: | S3 (Non-critical) |
Version: | 8.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[6 Nov 2024 14:59]
Val Doroshchuk
[6 Nov 2024 15:05]
Val Doroshchuk
`tc` requires sudo $ sudo XPLUGIN_PORT=5445 ./run_unit_tests --gtest_filter=Sess.connection_drop Note: Google Test filter = Sess.connection_drop [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from Sess [ RUN ] Sess.connection_drop terminate called after throwing an instance of 'cdk::foundation::Error' what(): CDK Error: OpenSSL: error:0A000126:SSL routines::unexpected eof while reading Aborted
[6 Nov 2024 15:12]
Val Doroshchuk
#3 0x0000738caa442476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 #4 0x0000738caa4287f3 in __GI_abort () at ./stdlib/abort.c:79 #5 0x0000738caa8a2b9e in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6 #6 0x0000738caa8ae20c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6 #7 0x0000738caa8ad1e9 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6 #8 0x0000738caa8ad959 in __gxx_personality_v0 () from /lib/x86_64-linux-gnu/libstdc++.so.6 #9 0x0000738cab2b6884 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1 #10 0x0000738cab2b6f41 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1 #11 0x0000738caa8ae4cb in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6 #12 0x0000738cab066651 in throw_openssl_error_msg (msg=0x738a3cdfc870 "error:00000000:lib(0)::reason(0)") at ./cdk/foundation/connection_openssl.cc:181 #13 0x0000738cab0666ed in throw_openssl_error () at ./cdk/foundation/connection_openssl.cc:190 #14 0x0000738cab0667a6 in throw_ssl_error (tls=0x738a3801bb70, err=-1) at ./cdk/foundation/connection_openssl.cc:220 #15 0x0000738cab068edf in cdk::foundation::connection::TLS::Read_op::common_read (this=0x738a24360880) at ./cdk/foundation/connection_openssl.cc:936 #16 0x0000738cab068d9e in cdk::foundation::connection::TLS::Read_op::do_cont (this=0x738a24360880) at ./cdk/foundation/connection_openssl.cc:910 #17 0x0000738caad5e013 in cdk::foundation::api::Async_op_base::cont (this=0x738a24360880) at ./cdk/include/mysql/cdk/protocol/../foundation/async.h:72 #18 0x0000738caae8ecbe in cdk::protocol::mysqlx::Protocol_impl::rd_cont (this=0x738a38084f10) at ./cdk/protocol/mysqlx/protocol.cc:575 #19 0x0000738caae8ed32 in cdk::protocol::mysqlx::Protocol_impl::rd_wait (this=0x738a38084f10) at ./cdk/protocol/mysqlx/protocol.cc:591 #20 0x0000738caae8f2b3 in cdk::protocol::mysqlx::Op_rcv::do_read_msg (this=0x738a240013c0, async=false) at ./cdk/protocol/mysqlx/protocol.cc:756 #21 0x0000738caae8f683 in cdk::protocol::mysqlx::Op_rcv::do_wait (this=0x738a240013c0) at ./cdk/protocol/mysqlx/protocol.cc:903 #22 0x0000738caad5e058 in cdk::foundation::api::Async_op_base::wait (this=0x738a240013c0) at ./cdk/include/mysql/cdk/foundation/async.h:78 #23 0x0000738caae89b5a in cdk::mysqlx::Cursor::close (this=0x738a24001440) at ./cdk/mysqlx/result.cc:620 #24 0x0000738caae89889 in cdk::mysqlx::Cursor::~Cursor (this=0x738a24001440, __in_chrg=<optimized out>) at ./cdk/mysqlx/result.cc:557 #25 0x0000738caae5698f in cdk::Cursor::~Cursor (this=0x738a24001430, __in_chrg=<optimized out>) at ./cdk/include/mysql/cdk/cursor.h:45 #26 0x0000738caae569ba in cdk::Cursor::~Cursor (this=0x738a24001430, __in_chrg=<optimized out>) at ./cdk/include/mysql/cdk/cursor.h:45 #27 0x0000738caae468d8 in mysqlx::abi2::r0::common::Result_impl::~Result_impl (this=0x738a24001550, __in_chrg=<optimized out>) at ./common/result.cc:192 #28 0x0000738caae4697c in mysqlx::abi2::r0::common::Result_impl::~Result_impl (this=0x738a24001550, __in_chrg=<optimized out>) at ./common/result.cc:194 #29 0x0000738caadf456c in mysqlx::abi2::r0::internal::Result_detail::~Result_detail (this=0x738a3cdfd020, __in_chrg=<optimized out>) at ./devapi/result.cc:495
[6 Nov 2024 15:13]
Val Doroshchuk
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737353512384) at ./nptl/pthread_kill.c:44 #1 __pthread_kill_internal (signo=6, threadid=140737353512384) at ./nptl/pthread_kill.c:78 #2 __GI___pthread_kill (threadid=140737353512384, signo=signo@entry=6) at ./nptl/pthread_kill.c:89 #3 0x00007ffff7042476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 #4 0x00007ffff70287f3 in __GI_abort () at ./stdlib/abort.c:79 #5 0x00007ffff74a2b9e in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6 #6 0x00007ffff74ae20c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6 #7 0x00007ffff74ad1e9 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6 #8 0x00007ffff74ad959 in __gxx_personality_v0 () from /lib/x86_64-linux-gnu/libstdc++.so.6 #9 0x00007ffff7f94884 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1 #10 0x00007ffff7f952dd in _Unwind_Resume () from /lib/x86_64-linux-gnu/libgcc_s.so.1 #11 0x00007ffff7a8596b in cdk::mysqlx::Stmt_op::do_cont (this=0x555555bf15f0) at ./cdk/mysqlx/result.cc:195 #12 0x00007ffff7a85a4d in cdk::mysqlx::Stmt_op::do_wait (this=0x555555bf15f0) at ./cdk/mysqlx/result.cc:233 #13 0x00007ffff795a248 in cdk::foundation::api::Async_op_base::wait (this=0x555555bf15f0) at ./cdk/include/mysql/cdk/foundation/async.h:78 #14 0x00007ffff7a85c08 in cdk::mysqlx::Stmt_op::discard_result (this=0x555555bf15f0) at ./cdk/mysqlx/result.cc:276 #15 0x00007ffff7a7280f in cdk::mysqlx::Stmt_op::discard (this=0x555555bf15f0) at ./cdk/include/mysql/cdk/mysqlx/result.h:633 #16 0x00007ffff7a724b8 in cdk::mysqlx::Stmt_op::~Stmt_op (this=0x555555bf15f0, __in_chrg=<optimized out>) at ./cdk/include/mysql/cdk/mysqlx/result.h:451 #17 0x00007ffff7a773fd in cdk::mysqlx::Query_stmt::~Query_stmt (this=0x555555bf15f0, __in_chrg=<optimized out>) at ./cdk/mysqlx/stmt.h:353 #18 0x00007ffff7a775c5 in cdk::mysqlx::Expectation<cdk::mysqlx::Query_stmt, (cdk::protocol::mysqlx::api::Protocol_fields::value)4>::~Expectation (this=0x555555bf15f0, __in_chrg=<optimized out>) at ./cdk/mysqlx/stmt.h:134 #19 0x00007ffff7a73e37 in cdk::mysqlx::Prepared<cdk::mysqlx::Query_stmt>::~Prepared (this=0x555555bf15f0, __in_chrg=<optimized out>) at ./cdk/mysqlx/stmt.h:405 #20 0x00007ffff7a7f1e5 in cdk::mysqlx::Cmd_StmtExecute::~Cmd_StmtExecute (this=0x555555bf15f0, __in_chrg=<optimized out>) at ./cdk/mysqlx/stmt.h:606 #21 0x00007ffff7a7f242 in cdk::mysqlx::Cmd_StmtExecute::~Cmd_StmtExecute (this=0x555555bf15f0, __in_chrg=<optimized out>) at ./cdk/mysqlx/stmt.h:606 #22 0x00007ffff7990e8c in std::_Sp_counted_ptr<cdk::mysqlx::Stmt_op*, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x555555caa290) at /usr/include/c++/10/bits/shared_ptr_base.h:380 #23 0x0000555555742823 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x555555caa290) at /usr/include/c++/10/bits/shared_ptr_base.h:158 #24 0x000055555573421d in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x555555bf3048, __in_chrg=<optimized out>) at /usr/include/c++/10/bits/shared_ptr_base.h:736 #25 0x00007ffff795b7b8 in std::__shared_ptr<cdk::mysqlx::Stmt_op, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x555555bf3040, __in_chrg=<optimized out>) at /usr/include/c++/10/bits/shared_ptr_base.h:1188 #26 0x00007ffff795b7d8 in std::shared_ptr<cdk::mysqlx::Stmt_op>::~shared_ptr (this=0x555555bf3040, __in_chrg=<optimized out>) at /usr/include/c++/10/bits/shared_ptr.h:121 #27 0x00007ffff797660b in cdk::Reply::~Reply (this=0x555555bf3030, __in_chrg=<optimized out>) at ./cdk/include/mysql/cdk/reply.h:44 #28 0x00007ffff7976640 in cdk::Reply::~Reply (this=0x555555bf3030, __in_chrg=<optimized out>) at ./cdk/include/mysql/cdk/reply.h:44 #29 0x00007ffff7a43d74 in mysqlx::abi2::r0::common::Result_impl::~Result_impl (this=0x555555cabbc0, __in_chrg=<optimized out>) at ./common/result.cc:193 #30 0x00007ffff7a43e1a in mysqlx::abi2::r0::common::Result_impl::~Result_impl (this=0x555555cabbc0, __in_chrg=<optimized out>) at ./common/result.cc:194 #31 0x00007ffff79f282e in mysqlx::abi2::r0::internal::Result_detail::~Result_detail (this=0x7fffffffd240, __in_chrg=<optimized out>) at ./devapi/result.cc:495 #32 0x00005555557296f2 in mysqlx::abi2::r0::internal::Row_result_detail<mysqlx::abi2::r0::Columns>::~Row_result_detail (this=0x7fffffffd240, __in_chrg=<optimized out>) at ./include/mysqlx/devapi/detail/result.h:314 #33 0x0000555555729750 in mysqlx::abi2::r0::internal::Result_common<mysqlx::abi2::r0::internal::Row_result_detail<mysqlx::abi2::r0::Columns> >::~Result_common (this=0x7fffffffd240, __in_chrg=<optimized out>) at ./include/mysqlx/devapi/result.h:71 #34 0x0000555555729de6 in mysqlx::abi2::r0::RowResult::~RowResult (this=0x7fffffffd240, __in_chrg=<optimized out>) at ./include/mysqlx/devapi/result.h:585 #35 0x0000555555828fda in mysqlx::abi2::r0::SqlResult::~SqlResult (this=0x7fffffffd240, __in_chrg=<optimized out>) at ./include/mysqlx/devapi/result.h:730 #36 0x00005555559351be in Sess_connection_drop_Test::TestBody (this=0x555555bde1a0) at ./devapi/tests/session-t.cc:4378 #37 0x0000555555a06ca3 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) () #38 0x00005555559ff7c7 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) () #39 0x00005555559dafd4 in testing::Test::Run() () #40 0x00005555559dba18 in testing::TestInfo::Run() () #41 0x00005555559dc3a8 in testing::TestSuite::Run() () #42 0x00005555559ec6e0 in testing::internal::UnitTestImpl::RunAllTests() () #43 0x0000555555a08230 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) () #44 0x0000555555a00a69 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) () #45 0x00005555559eacf5 in testing::UnitTest::Run() () #46 0x000055555565f3e9 in RUN_ALL_TESTS () at /opt/googletest-1.15.2/include/gtest/gtest.h:2334 #47 0x000055555565f309 in main (argc=1, argv=0x7fffffffdaf8) at ./build/tests_main.cc:66
[6 Nov 2024 15:15]
Val Doroshchuk
(gdb) bt #0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=134761020393024) at ./nptl/pthread_kill.c:44 #1 __pthread_kill_internal (signo=6, threadid=134761020393024) at ./nptl/pthread_kill.c:78 #2 __GI___pthread_kill (threadid=134761020393024, signo=signo@entry=6) at ./nptl/pthread_kill.c:89 #3 0x00007a92e6242476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 #4 0x00007a92e62287f3 in __GI_abort () at ./stdlib/abort.c:79 #5 0x00007a92e66a2b9e in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6 #6 0x00007a92e66ae20c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6 #7 0x00007a92e66ad1e9 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6 #8 0x00007a92e66ad959 in __gxx_personality_v0 () from /lib/x86_64-linux-gnu/libstdc++.so.6 #9 0x00007a92e7641884 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1 #10 0x00007a92e76422dd in _Unwind_Resume () from /lib/x86_64-linux-gnu/libgcc_s.so.1 #11 0x00007a92e6e88b17 in cdk::mysqlx::Stmt_op::do_cont (this=0x7a8e61350820) at ./cdk/mysqlx/result.cc:195 #12 0x00007a92e6e76db2 in cdk::mysqlx::Query_stmt::do_cont (this=0x7a8e61350820) at ./cdk/mysqlx/stmt.h:373 #13 0x00007a92e6e8668f in cdk::mysqlx::Expectation<cdk::mysqlx::Query_stmt, (cdk::protocol::mysqlx::api::Protocol_fields::value)4>::do_cont (this=0x7a8e61350820) at ./cdk/mysqlx/stmt.h:203 #14 0x00007a92e6e88bf9 in cdk::mysqlx::Stmt_op::do_wait (this=0x7a8e61350820) at ./cdk/mysqlx/result.cc:233 #15 0x00007a92e6d5e058 in cdk::foundation::api::Async_op_base::wait (this=0x7a8e61350820) at ./cdk/include/mysql/cdk/foundation/async.h:78 #16 0x00007a92e6e88db4 in cdk::mysqlx::Stmt_op::discard_result (this=0x7a8e61350820) at ./cdk/mysqlx/result.cc:276 #17 0x00007a92e6e7585d in cdk::mysqlx::Stmt_op::discard (this=0x7a8e61350820) at ./cdk/include/mysql/cdk/mysqlx/result.h:633 #18 0x00007a92e6e7a57b in cdk::mysqlx::Expectation<cdk::mysqlx::Query_stmt, (cdk::protocol::mysqlx::api::Protocol_fields::value)4>::~Expectation (this=0x7a8e61350820, __in_chrg=<optimized out>) at ./cdk/mysqlx/stmt.h:130 #19 0x00007a92e6e76e79 in cdk::mysqlx::Prepared<cdk::mysqlx::Query_stmt>::~Prepared (this=0x7a8e61350820, __in_chrg=<optimized out>) at ./cdk/mysqlx/stmt.h:403 #20 0x00007a92e6e824b1 in cdk::mysqlx::Cmd_StmtExecute::~Cmd_StmtExecute (this=0x7a8e61350820, __in_chrg=<optimized out>) at ./cdk/mysqlx/stmt.h:604 #21 0x00007a92e6e8250e in cdk::mysqlx::Cmd_StmtExecute::~Cmd_StmtExecute (this=0x7a8e61350820, __in_chrg=<optimized out>) at ./cdk/mysqlx/stmt.h:604 #22 0x00007a92e6d954e6 in std::_Sp_counted_ptr<cdk::mysqlx::Stmt_op*, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x7a8e0fff0070) at /usr/include/c++/10/bits/shared_ptr_base.h:380 #23 0x00005b4353bd33f3 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() () #24 0x00007a92e6d6d799 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x7a901c16c648, __in_chrg=<optimized out>) at /usr/include/c++/10/bits/shared_ptr_base.h:736 #25 0x00007a92e6d5f564 in std::__shared_ptr<cdk::mysqlx::Stmt_op, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x7a901c16c640, __in_chrg=<optimized out>) at /usr/include/c++/10/bits/shared_ptr_base.h:1188 #26 0x00007a92e6d5f584 in std::shared_ptr<cdk::mysqlx::Stmt_op>::~shared_ptr (this=0x7a901c16c640, __in_chrg=<optimized out>) at /usr/include/c++/10/bits/shared_ptr.h:121 #27 0x00007a92e6d79e39 in cdk::Reply::~Reply (this=0x7a901c16c630, __in_chrg=<optimized out>) at ./cdk/include/mysql/cdk/reply.h:44 #28 0x00007a92e6d79e6e in cdk::Reply::~Reply (this=0x7a901c16c630, __in_chrg=<optimized out>) at ./cdk/include/mysql/cdk/reply.h:44 #29 0x00007a92e6d79eb1 in cdk::foundation::scoped_ptr<cdk::Reply>::~scoped_ptr (this=0x7a8e7bd791a0, __in_chrg=<optimized out>) at ./cdk/include/mysql/cdk/foundation/types.h:191 #30 0x00007a92e6dba913 in mysqlx::impl::common::Op_base<mysqlx::abi2::r0::common::Bind_if>::~Op_base (this=0x7a8e7bd79180, __in_chrg=<optimized out>) at ./xapi/../common/op_impl.h:145 #31 0x00007a92e6db255b in mysqlx::impl::common::Op_sql::~Op_sql (this=0x7a8e7bd79180, __in_chrg=<optimized out>) at ./xapi/../common/op_impl.h:1251 #32 0x00007a92e6db257a in mysqlx::impl::common::Op_sql::~Op_sql (this=0x7a8e7bd79180, __in_chrg=<optimized out>) at ./xapi/../common/op_impl.h:1251
[6 Nov 2024 15:31]
MySQL Verification Team
Hi Mr. Doroshchuk, This is not a forum for the bugs in the trunk. If you have a report for a bug in any of the latest released release, please report it. Otherwise, we shall have to close this ticket.
[6 Nov 2024 17:33]
Val Doroshchuk
Sorry, updated actual version reproduced in 8.0.30.
[7 Nov 2024 5:33]
Bogdan Degtyariov
Thank you for the bug report and for the proposed solution. We will come back to you after analyzing it.
[7 Nov 2024 10:29]
Val Doroshchuk
The issue with forever hang reported in https://bugs.mysql.com/bug.php?id=116580 since looks should be fixed separately.
[13 Nov 2024 10:43]
MySQL Verification Team
Thank you Mr. Doroshchuk, This is now a fully verified bug for the version 8.0 and higher.
[15 Nov 2024 8:52]
Rafal Somla
Posted by developer: Thank you for the bug report. Your description of the issue says "If there is connection drop during executing the query, an exception is thrown ...". That sounds like a correct behavior to me -- there is broken connection so our code throws error. Is the problem here that the error is thrown from a destructor and therefore user can not catch it (and ignore, for example)? Above is for the case where error is thrown. Hanging because of the dropped connection is another issue which is plainly wrong. However, it is not clear to me if the traces you provided capture the hang situation. AFAICS only the first trace corresponds to the shown test output ``` terminate called after throwing an instance of 'cdk::foundation::Error' what(): CDK Error: OpenSSL: error:0A000126:SSL routines::unexpected eof while reading Aborted ``` In the trace I can see that `throw_openssl_error()` was called which corresponds to above behavior (and indicates that IO error reported by OpenSSL was correctly detected). But the other two traces are different and look like exception thrown inside `cdk::mysqlx::Stmt_op::do_cont()`. However I have no information what was the corresponding test behavior -- did it crash? did it print some error message? or did it hang and you killed it? Knowing that would help us to understand the issue better before we can reproduce it. Btw. I can not look at the fix you provided before you sign the OCA agreement.
[15 Nov 2024 10:48]
Val Doroshchuk
Thank you, Rafal for looking at. > Is the problem here that the error is thrown from a destructor and therefore user can not catch it (and ignore, for example)? Correct, the issue there is no way to workaround connection drop during mysqlx::Session.sql(SELECT...).execute(). Since it throws an exception from the destructors. Provided fix covers 2 places where it might throw and works for us so far. > But the other two traces are different and look like exception thrown inside `cdk::mysqlx::Stmt_op::do_cont()`. However I have no information what was the corresponding test behavior -- did it crash? or did it hang and you killed it? All posted stack traces are caused by the same issue and the same test case. The description is one of these: for SSL enabled: - CDK Error: OpenSSL: error:0A000126:SSL routines::unexpected eof while reading for SSL disabled: - CDK Error: Cannot perform this action because input stream is in EOS state (cdk-io:1) PS: > I can not look at the fix you provided before you sign the OCA agreement. Signed, thanks
[15 Nov 2024 10:52]
MySQL Verification Team
Thanks to both of you, Rafal and Mr. Doroshchuk.
[15 Nov 2024 16:14]
Rafal Somla
Posted by developer: OK, the other stacks seem to be for the case where SSL is disabled. Not sure if any of them captures a situation where application hangs after broken connection but I think we are nailing it in the other bug. Here I agree we should re-consider throwing exceptions from destructors (not do that most likely). Our implementation needs a review from that perspective.
[6 Dec 2024 16:29]
MySQL Verification Team
Thank you, Rafal,
[12 Dec 2024 8:51]
Rafal Somla
Posted by developer: Fixed by ensuring that any exceptions that could potentially be thrown inside destructors are caught and ignored. Thanks for bringing this up and helping us to improve the code!
[12 Dec 2024 11:09]
MySQL Verification Team
Thank you, Rafal. We think that this bug can be set to the "Closed" status.
[24 Dec 2024 21:42]
Philip Olson
Posted by developer: Fixed as of the upcoming MySQL Connector/C++ 9.2.0 release, and here's the proposed changelog entry from the documentation team: Exceptions are no longer thrown inside a destructor. Thank you for the bug report.
[9 Jan 10:52]
MySQL Verification Team
Thank you, Philip.