APCuIterator:Could not compile regular expression

Sometimes I get a "HTTP ERROR 500" on loading a page.

The first time it happened the very first load of the website. Looking in the log the error is:

PHP Fatal error:  APCuIterator::__construct(): Could not compile regular expression: [bdb9e21fd62195c66628e3356990c7b9::bdb9e21fd62195c66628e3356990c7b9::sp::stash_default::dic::di\\definition\\group_tools::*] in /vendor/tedivm/stash/src/Stash/Driver/Apc.php on line 123, referer: https://mydomain/admin

if I comment line 123 it can load the page. And everything goes on then even if I decomment the line 123. But sometime the error returns, always when I flush the cache.

It also works if I leave

$it = new \APCUIterator('user',$keyRegex, \APC_ITER_KEY, $chunkSize);

 

instead of 

$it = $this->apcu ? new \APCUIterator($keyRegex, \APC_ITER_KEY, $chunkSize) : new \APCIterator('user', $keyRegex, \APC_ITER_KEY, $chunkSize);

I cannot figure out how to set up the problem, can you help me, please?

Giorgio