Bug #112328 build_cache_of_ndb_users running from slave thread doesn't work
Submitted: 12 Sep 2023 22:50 Modified: 8 Nov 2023 11:14
Reporter: Mikael Ronström Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:8.0.23 OS:Any
Assigned to: CPU Architecture:Any

[12 Sep 2023 22:50] Mikael Ronström
Description:
When combining setting up MySQL Cluster Replication and using
NDB stored users a segmentation fault is hit in build_cache_of_ndb_users.
The reasons is that it calls exec_sql that executes a function that
eventually ends up in mysql_execute_command. However since it is executed
from the slave thread it reports success with no result set.
This doesn't play with the functionality of build_cache_of_ndb_users and
a seg fault occurs.

How to repeat:
Run a set up of replication with ndb stored users in the cluster.

Suggested fix:
Ensure that exec_sql somehow ignores that it is currently running as a slave thread during execution of exec_sql.
[13 Sep 2023 5:29] MySQL Verification Team
Hello Mikael,

Thank you for the report and feedback.

Sincerely,
Umesh
[19 Oct 2023 21:13] John Duncan
Posted by developer:
 
Hi Mikael,

There is an MTR test called ndb_rpl_stored_grants that seems to test the situation you are describing. And in build_cache_of_ndb_users(), it is expected that the query can succeed but return 0 rows. So I think there must be something slightly different happening in this crash. Can you supply the stack trace? Or possibly something more to help reproduce the crash?

Thanks,

JD
[20 Oct 2023 7:00] Mikael Ronström
Added a code contribution with a test case and the fix for this bug:
https://github.com/mysql/mysql-server/pull/498
[20 Oct 2023 7:34] Mikael Ronström
Turns out that the PR was a duplicate of a code contribution already made.
See BUG#112775.
[8 Nov 2023 11:13] Magnus Blåudd
Posted by developer:
 
As stated by reporter this is duplicate and has been fixed in upcoming version of MySQL. Closing as duplicate.