One more problem found causing some of the rnadom breakages here and there:
There is one memory limit for the script: @raise_memory_limit('128M');
And, when the number of messages in forum are high, if grows, and grows, and grows... and break somewhere (in the forum cron itself) or later, when the script requires memory over the limit.
But the place were memory grows continuously is forum cron (just guessing if it's due to some cap/role/context cache) that, not having limits, causes this to happen. IMO, all those static caches, than can be executed from cron.... should have a limit.
Call this the RAISE_MEMORY_LIMIT_PROBLEM from now.
After HQ chat, we think the proper solution is to limit the role/context/cap caches to a number of elements (constant?). Each time the cache is full, first element will be removed and the new one inserted.