Fail-Fast (meaning "quick abort") describes the ability of a system to detect errors early on. A fail-fast system is designed in such a way that it detects and displays errors or states that lead to errors at its interfaces . Fail-fast systems usually terminate themselves in the event of an error and do not try to continue working with the error.
Fail-fast systems often not only check the interfaces, but also the status of a system at various points in order to detect errors at an early stage. Error handling is delegated to the caller of the system - if this can put it into a safe state, this is called fail-safe .
Example: Before performing a division, a computer program recognizes that the divisor is equal to zero and returns an error message instead of performing a division by zero , which would have an undefined result.
Use of fail-fast systems
Fail-fast systems or modules are preferred over conventional systems if the early detection, identification and final handling of error states appears sensible as opposed to potentially incorrect processing. This is particularly the case when error states are not revealed until they lead to errors in other modules or systems or lead to irreversible or costly damage.
When creating fault-tolerant systems using redundant components, each individual component should be fail-fast in order to provide the overall system with information in good time to compensate for the fault.
Fail-fast systems help to find the cause of errors because such systems deliver errors more promptly and with more precise information. In fault-tolerant systems, errors can go undetected; in systems that are neither fault-tolerant nor fail-fast , these can cause apparently independent problems at a later point in time. It can be laborious to trace this back to the original error.
In software engineering , a Fail Fast Iterator is an iterator that reports an error as soon as the list it is iterating over is changed during the iteration.
- Jim Gray: Why Do Computers Stop and What Can Be Done About It. (PDF; 924 kB) Tandem Computers, June 1985, p. 35 , accessed on January 29, 2012 (English).
- Jim Shore: Fail Fast. (PDF; 123 kB) Martin Fowler , 2004, pp. 21–25 , accessed on January 29, 2012 (English).
- Fail Fast. Retrieved January 29, 2012 . - Fail Fast in thePortland Pattern Repository