After VM update to 3.8.8 and Joomla to 3.10.8 we get the warning message in our php error logs:
Warning: mysqli::stat(): Couldn't fetch mysqli in /libraries/joomla/database/driver/mysqli.php on line 216
The cause is in the following line
if ($this->connection instanceof mysqli && $this->connection->stat() !== false)
The problem causes the function $this->connection->stat(). I think this happens because the connection to the database is closed repeatedly.
To fix the warning we have added another check for $this->connection:
$this->connection instanceof resource
So the line 216 now looks like this:
if ($this->connection instanceof mysqli && $this->connection instanceof resource && $this->connection->stat() !== false)
I hope this helps the others who get the same warning.
It will be better if you use the following codes instead -
if ($this->connection instanceof mysqli && is_resource($this->connection) && $this->connection->stat() !== false)