[MDEV-7096] In THD::cleanup(), apc_target.destroy() has assertion failure. Created: 2014-11-12  Updated: 2022-11-09  Resolved: 2022-11-09

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.0
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Minli Zhu Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: None

Issue Links:
Blocks
is blocked by MDEV-8066 Crash on unloading semisync_master pl... Closed

 Description   

In sql/sql_class.cc, THD::cleanup() calls apc_target.destroy().

The latter has:
DBUG_ASSERT(!enabled) which fails during our test which triggers this code path.

The fix is to disable apc_target if it is enabled before destroying it.

Proposed patch:

void THD::cleanup(void)
{
...
  DBUG_ASSERT(!mdl_context.has_locks());
 
+  if (apc_target.is_enabled())
+    apc_target.disable();
  apc_target.destroy();
...
}



 Comments   
Comment by Sergei Golubchik [ 2014-11-14 ]

Can you show your tests or explain how to trigger that?
As far as I can see apt_target should be disabled when lex->explain is destroyed.

Does it only happen in the context of MDEV-7095 — when you invoke that dead code in Ed_connection::execute_direct() ?

Comment by Minli Zhu [ 2014-11-14 ]

Yes, it is triggered by Ed_connection::execute_direct().

Comment by chu huaxing [ 2019-01-09 ]

What is the latest development on this issue? I also encountered this problem, and I agree with Minli Zhu .

Comment by Sergei Golubchik [ 2022-11-09 ]

Ed_connection::execute_direct() was dead code. Now we have a service API for executing SQL statements from inside the server, please, use that

Generated at Thu Feb 08 07:16:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.