Simulate Process Faults

This document describes how to use Chaosd to simulate process faults. The process faults use the Golang interface of the kill command to simulate the scenarios that the process is killed or stopped. You can create experiments either in command-line mode or service mode.

Create experiments in command-line mode

Before creating an experiment, you can run the following command to see the process fault types that are supported by Chaosd:

  1. chaosd attack process -h

The output is as follows:

  1. Process attack related commands
  2. Usage:
  3. chaosd attack process [command]
  4. Available Commands:
  5. kill kill process, default signal 9
  6. stop stop process, this action will stop the process with SIGSTOP
  7. Flags:
  8. -h, --help help for process
  9. Global Flags:
  10. --log-level string the log level of chaosd, the value can be 'debug', 'info', 'warn' and 'error'
  11. Use "chaosd attack process [command] --help" for more information about a command.

Currently, Chaosd supports simulating that a process is killed or stopped.

Killing a process

Command simulating that a process is killed

  1. chaosd attack process kill -h

The output is as follows:

  1. kill process, default signal 9
  2. Usage:
  3. chaosd attack process kill [flags]
  4. Flags:
  5. -h, --help help for kill
  6. -p, --process string The process name or the process ID
  7. -s, --signal int The signal number to send (default 9)
  8. Global Flags:
  9. --log-level string the log level of chaosd, the value can be 'debug', 'info', 'warn' and 'error'

Configuration description of simulating a process being killed

Configuration itemAbbreviationDescriptionValue
processpThe name or identifier of the process that needs to be killedstring; the default value is “”.
signalsThe provided value of the process signalint; the default value is 9. Currently, only SIGKILL, SIGTERM, and SIGSTOP are supported.

Example simulating that a process is killed

  1. chaosd attack process kill -p python

The output is as follows:

  1. Attack process python successfully, uid: 10e633ac-0a37-41ba-8b4a-cd5ab92099f9

Stopping a process

Command simulating that a process is stopped

  1. chaosd attack process stop -h

The output is as follows:

  1. stop process, this action will stop the process with SIGSTOP
  2. Usage:
  3. chaosd attack process stop [flags]
  4. Flags:
  5. -h, --help help for stop
  6. -p, --process string The process name or the process ID
  7. Global Flags:
  8. --log-level string the log level of chaosd, the value can be 'debug', 'info', 'warn' and 'error'

Configuration description of simulating a process being stopped

Configuration itemAbbreviationDescriptionValue
processpThe name or identifier of the process that needs to be stoppedstring; the default value is “”.

Example simulating that a process is stopped

  1. chaosd attack process stop -p python

The output is as follows:

  1. Attack process python successfully, uid: 9cb6b3be-4f5b-4ecb-ae05-51050fcd0010

Create experiments in service mode

(To be added)