Hermit, a tool for controlled testing and error detection


Hermit, as a reproducible container, gives an idea of ​​what it would be like if the system stack provided repeatability as an abstraction

Facebook unveiled recently through a publication, the launch of Hermit, which forms a environment for deterministic program execution, which makes it possible to achieve the same result and repeat the execution process on different launches using the same input data.

During normal execution, various extraneous factors affect the output, such as the current time, thread scheduling functions, virtual memory addresses, data from a pseudorandom number generator, and various unique identifiers.

Hermit allows to run the program in a container where these factors remain constant in subsequent runs. Repeatable execution, which fully reproduces the configuration of the volatile environment, can be used for error diagnosis, debugging multi-step with iterations, creating a fixed environment for regression testing, stress testing, multi-threaded troubleshooting, and repeatable build systems.

Hermit forces deterministic execution of arbitrary programs and acts as a reproducible wrapper. That is, it hermetically isolates the program from sources of non-determinism such as timing, thread interleaving, random number generation, etc. Guaranteed determinism is a powerful tool and serves as the foundation for a number of applications, including concurrency stress testing, record/replay, reproducible builds and automatic diagnosis of concurrency errors, and more.

Hermit cannot isolate the guest program from sources of non-determinism, such as file system changes or responses from external networks. Instead, to provide full determinism, the user must provide a fixed file system base image (for example, with Docker) and disable external networks.

About Hermit

Hermit allows power creates a reproducible environment by intercepting system calls, some of which are replaced with their own handlers that produce constant output, and some of which are redirected to the kernel, after which non-persistent data is removed from the output.

To intercept calls To the system, framework is used reverie, whose code is also published by Facebook. To prevent file system changes and network requests from affecting execution progress, execution is performed using a still image of the file system and with access to external networks disabled. By accessing the pseudorandom number generator, Hermit produces a predefined sequence that is repeated each time it is executed.

The most complex source of non-determinism is in the thread scheduler. The way the kernel schedules threads depends on many external factors, including the number of physical CPUs or other threads running on the system that require CPU time.

Of the more complex non-permanent influences on performance, highlights thread scheduler, whose behavior depends on many external factors, such as the number of CPU cores and the presence of other running threads.

To ensure repeatable scheduler behavior, all threads are serialized, bound to a single CPU core and in the order in which control is passed to the threads. Each thread is allowed to execute a fixed number of instructions, after which execution is stopped and transferred to another thread (for limiting, the CPU PMU (Performance Monitoring Unit) is used, which stops execution after a specified number of conditional branches).

To diagnose problems with threads due to a race condition, Hermit has a mode to detect operations that were out of order and caused a blockade. In order to identify such problems, a comparison is made between the states in which the correct operation and the abnormal termination of the execution were registered.

Finally, if you are interested in being able to learn more about it, you should know that the project code it is written in Rust and is distributed under the BSD license.

You can check the details in the following link.

The content of the article adheres to our principles of editorial ethics. To report an error click here.

Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.