actonlang / acton

The Acton Programming Language
https://www.acton-lang.org/
BSD 3-Clause "New" or "Revised" License
76 stars 7 forks source link

Using exception handling for OOM #1783

Open plajjan opened 3 months ago

plajjan commented 3 months ago

Could we / should we use our exception handling for dealing with OOM errors? It's hard to recover from OOM but at least this would give us a central point for dealing with it? for distributed RTS, an actor that hit OOM can be abandoned and cleaned up locally, then another RTS node can resume it, hopefully with more memory.

nordlander commented 3 months ago

Yes, that's reasonable. The crux is just if the exception handler itself needs to allocate memory...

But with unboxed values and fewer witnesses constructed dynamically, memory consumption should become more controllable by the programmer. One simply has to avoid creating data structures in the OOM handlers!

plajjan commented 3 months ago

I reckon it's a default exception handler, in the RTS that does the handling. Not something written by the developer (although it would of course be possible for a user to catch. But uncertain what they could do about it).

The way I see it, the OOMException actually belongs further up the exception hierarchy than our current root. Like when a developer does a unconditioned except, I think the intent, as with python, is to handle all "normal" errors and move on. But OOM is not normal in any way, it's a whole other level of exceptional, so I think it belongs further up. What do you think?