Lost connection to database - a lot of entries in logfile

Nextcloud version (eg, 20.0.5): 20.0.5
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04.1 (Docker)

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it:

  1. Dunno, use Nextcloud?

I have noticed the entries in the screenshot above a few times. The thing is that I haven’t noticed anything not working (both web interface and desktop sync seems to work). The only thing is that, a couple of times per day (when I have checked), the MariaDB (mysql service) is taking a lot of resources (2 threads, 60-90% for like 20-30 minutes). When I look at the queries - it seems like it goes thru the whole database (almost 1GB), but why?

So I have noticed the entries in the screenshot and also that the mysql service takes up a lot of resources, dunno if they are related tho.

I am running on a pretty decent machine (Ryzen 2600, 16GB ECC, SSD for Docker and 4TB HDD for data - and only 3 users - so I don’t see that being the problem, normal load when mysql service not doing it’s thing is like more or less 1-2%.

Any pointers?
Big thanks in advance!

Edit: Checked the limit of connection with ulimit -n for MariaDB/MySQL and it returned 1048576(!) Seems like crazy much, but maybe normal?

I think I have identified the problem - it’s happening when opening a folder with a lot of pictures (tried with 1000+) and scrolling pretty fast.