On Monday, 14 April 2025 at 15:42:07 UTC, Derek Fawcus wrote:
>On Monday, 14 April 2025 at 15:24:37 UTC, Richard (Rikki) Andrew Cattermole wrote:
>It is important to note that a task isn't always a process. But once an event like null dereference occurs that task must die.
It is not the dereference which is the issue, that is the downstream symptom of an earlier problem. If that reference is never supposed to be null, then the program is already in a non deterministic even without the crash.
This is the exact problem. The solution proposed here just doesn't understand what the actual problem is. Null dereferences, and index out-of-bounds are programming errors. You need to fix them in the program, not recover and hope for the best.
Trying to recover is the equivalent of a compiler resolving a syntax ambiguity with a random number generator.
Null dereference?
- Is it because I trusted a user value? => validate user input, rebuild, redeploy
- Is it because I forgot to initialize something? => initialize it, rebuild, redeploy
- Is it because I forgot to validate something? => do the validation properly, fix whatever it was sending in invalid data, rebuild, redeploy
- Is it something else? => thank you program, for crashing instead of corrupting everything. Now, time to find the memory corruption somewhere.
Similar flow chart for out-of-bounds errors.
-Steve