If in PHP I code an error and a user triggers it, that user gets a blank page but the website keeps working fine for everyone else. But it already happened multiple times that my Rust/Actix-web application just terminates when a user triggers an error! I need a way to 'isolate' these sessions and solve this issue!
The whole damn site cannot be terminated if one user triggers an error!
That is not the normal behavior. Tokio (which actix-web uses) will catch panics in tasks, which prevents them from bringing down the process.
Perhaps you could say more about what kind of error is happening? Maybe you have a double panic, where the thread panics during a panic. This is pretty rare, but will bring down the process.
As others have mentioned, this shouldn't happen in normal circumstances. Are you sure the whole server goes down, instead of dropping one connection?
Maybe you're compiling code with panic=abort setting? Do you have a reverse proxy in front of the server that could prematurely assume it's dead? (e.g. nginx can temporarily stop routing traffic if it sees too many errors from a backend).
But regardless of that, it may be a good idea to run the server under a supervisor that will restart it automatically. For example, make a systemd unit for it.
Even if panics are caught per-task, the app-state could be corrupted in a way that all subsequent requests also fail. Often this happens if the panic poisons locks or mutexes.