this might be related to
MDEV-26537, but after having installed 10.6.7 on FreeBSD (in an effort to upgrade from 10.5.x), mariadb starts to hang on certain InnoDB queries. I noticed it happening with my nextcloud executing some queries, completely randomly. 10.5.15 is the one I run now, it doesn't seem to be affected by this.
When this happens, mariadb starts to overwhelm itself, the queries for the DB hang, and I can't even kill them from within the mariadb command line. If I try and restart mariadb, it doesn't shut down by itself, only sending a KILL signal helps, which corrupts other databases in return. Also as it happens, it starts to eat up memory and spins the disk and CPU at almost the maximum rate.
I had this happening a couple times, tried even dumping and loading back the nextcloud database to see if a newly loaded DB would help, but it isn't the case. The last time it happened, my production server almost died in it, exhausting memory: swap full, starting to kill the mariadb process as it was the one eating up all memory.
I'm afraid I can't be of much help to you now as I had to forcefully go back to 10.5.x (which resulted in a halfway upgraded DB but I could get around it for now), to get my production server in a stable condition again.
We had a go at
MDEV-26537 earlier, that seemed to have been fixed, I think this is related to that bug.
It is frightening to know that a FreeBSD package that a lot of my systems are relying on, is buggy and breaks my server.