Bug #115258 hang bug in mysql NDB cluster
Submitted: 9 Jun 10:01 Modified: 12 Jun 1:43
Reporter: CunDi Fang Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:8.0.35-cluster MySQL Cluster Community S OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any

[9 Jun 10:01] CunDi Fang
Description:
OS version and name:
Ubuntu 22.04.3 LTS (Jammy Jellyfish)
Linux eb1f47b08982 6.5.11-8-pve #1 SMP PREEMPT_DYNAMIC PMX 6.5.11-8 (2024-01-30T12:27Z) x86_64 x86_64 x86_64 GNU/Linux

PoC:
'''
delete from mytest100.test0
where
EXISTS (
  select
      ref_6.name as c0,
      mytest100.test0.column2 as c1
    from
      mysql.plugin as ref_0
        right join ndbinfo.index_stats as ref_1
            inner join information_schema.INNODB_FT_INDEX_TABLE as ref_2
            on (EXISTS (
                select
                    ref_2.WORD as c0,
                    (select LOCKED_BY_THREAD_ID from performance_schema.mutex_instances limit 1 offset 95)
                       as c1,
                    mytest100.test0.column5 as c2,
                    ref_3.server_id as c3,
                    ref_3.server_id as c4
                  from
                    mysql.ndb_apply_status as ref_3
                  where mytest100.test0.column0 is not NULL
                  limit 84))
          left join sys.ps_check_lost_instrumentation as ref_4
              right join information_schema.COLLATIONS as ref_5
              on (false)
            right join mysql.help_keyword as ref_6
              right join information_schema.STATISTICS as ref_7
              on (ref_6.help_keyword_id = ref_7.NON_UNIQUE )
            on (ref_5.ID = ref_7.CARDINALITY )
          on (((ref_1.sample_version is not NULL)
                or (false))
              and (EXISTS (
                select
                    mytest100.test0.column1 as c0,
                    ref_5.SORTLEN as c1,
                    ref_7.SEQ_IN_INDEX as c2,
                    ref_5.IS_DEFAULT as c3,
                    ref_6.name as c4,
                    ref_6.name as c5,
                    ref_8.read_backup as c6,
                    ref_2.WORD as c7,
                    mytest100.test0.column5 as c8,
                    mytest100.test0.column4 as c9,                    ref_2.DOC_ID as c10,
                    ref_6.help_keyword_id as c11,
                    ref_5.IS_DEFAULT as c12,
                    ref_2.DOC_ID as c13
                  from
                    ndbinfo.table_info as ref_8
                  where true)))
        on ((ref_7.PACKED is not NULL)
            or ((ref_5.IS_COMPILED is NULL)
              or ((ref_6.help_keyword_id is not NULL)
                or (ref_5.SORTLEN is not NULL))))
    where (ref_4.variable_value is NULL)
      and (ref_6.help_keyword_id is NULL)
    limit 32);
'''
This SQL statement will not be able to be stopped or return results, and can ultimately only be cancelled by forcing the mysql process to be killed.

How to repeat:
Architecture Information:
'''
[NDBD DEFAULT]
NoOfReplicas =2
DataMemory = 512M
IndexMemory = 64M

[NDB_MGMD]
NodeId=1
hostname =192.172.10.8
datadir =/var/lib/mysql-cluster

[NDBD]
NodeId =2
hostname =192.172.10.9
datadir =/usr/local/mysql-cluster/data
NodeGroup=0
[NDBD]
NodeId =3
hostname =192.172.10.10
datadir =/usr/local/mysql-cluster/data
NodeGroup=1
[NDBD]
NodeId =4
hostname =192.172.10.11
datadir =/usr/local/mysql-cluster/data
NodeGroup=0
[NDBD]
NodeId =5
hostname =192.172.10.12
datadir =/usr/local/mysql-cluster/data
NodeGroup=1

[mysqld]
NodeId =6
hostname =192.172.10.9
[mysqld]
NodeId =7
hostname =192.172.10.10
[mysqld]
NodeId =8
hostname =192.172.10.11
[mysqld]
NodeId =9
hostname =192.172.10.12
'''

Attempted and successfully reproduced!

Suggested fix:
There should be a problem with the query plan generation and optimisation of the SQL.
[9 Jun 10:01] CunDi Fang
Here is the error log:
2024-06-09T09:03:52.483506Z 0 [System] [MY-010866] [NDB] Metadata: Failed to submit table 'mysql.ndb_apply_status' for synchronization
mbind: Operation not permitted
2024-06-09T09:04:52.489797Z 0 [System] [MY-010866] [NDB] Metadata: Failed to submit table 'mysql.ndb_apply_status' for synchronization
2024-06-09T09:05:52.496659Z 0 [System] [MY-010866] [NDB] Metadata: Failed to submit table 'mysql.ndb_apply_status' for synchronization
2024-06-09T09:06:52.502972Z 0 [System] [MY-010866] [NDB] Metadata: Failed to submit table 'mysql.ndb_apply_status' for synchronization
2024-06-09T09:07:52.511564Z 0 [System] [MY-010866] [NDB] Metadata: Failed to submit table 'mysql.ndb_apply_status' for synchronization
[12 Jun 1:43] MySQL Verification Team
Hi,

ndbcluster is not meant to be used with queries like this. Please use InnoDB Cluster / Group Replication for this type of use case.