I don't feel like this has anything to do with timing out nor would it in another system, as the system is purportedly running out of memory.
I think the first port of call should be investigating if something is unnecessarily utilising a lot more memory than it should. Perhaps objects are being held in memory and not released even?
How many rows of data results in this occurring?
Is this on OneStream cloud or self hosted? I guess if self-hosted there could be something else chewing up memory.
I haven't encountered this myself but I have caused a server to restart due to an infinite loop - its easy to get ourselves in trouble with the power of .net at our fingertips!