Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't call std::terminate on connection drop #36

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

valbok
Copy link

@valbok valbok commented Nov 6, 2024

https://bugs.mysql.com/bug.php?id=116569

If there is connection drop during executing the query, an exception is thrown from cdk::mysqlx::Cursor::~Cursor() or cdk::mysqlx::Stmt_op::~Stmt_op().

note: in C++11 destructors default to ‘noexcept’ - that means it leads to call std::terminate().

$ sudo XPLUGIN_PORT=5445  ./run_unit_tests --gtest_filter=Sess.connection_drop
[ 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

NOTE: Sess.connection_drop test case may should be excluded since it uses tc + system

There might be several ways to reproduce the terminate.

  1. Kill MySQL during the execution of SELECT query: killall -9 mysqld
  2. Forcing 100% packet loss and after mysqlx_write_timeout seconds MySQL will close the connection.

Using traffic control to force the packet loss + mysqlx_write_timeout can also introduce the infinite hang in TLS::Read_some_op::common_read() or recv_some()->poll_one() , similar to https://bugs.mysql.com/bug.php?id=92325

This MR introduces suggested fix to fix the terminate when the connection is closed.

@mysql-oca-bot
Copy link

Hi, thank you for submitting this pull request. In order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at https://oca.opensource.oracle.com/
Please make sure to include your MySQL bug system user (email) in the returned form.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants