All Products
Search
Document Center

Function Compute:How to avoid zombie processes in a custom runtime?

Last Updated:Aug 20, 2025

Possible causes

Zombie processes may be generated due to code errors.

Solutions

If you select Use Custom Runtime and configure Startup Command when you create a function, Process 1 in the system is your startup command. In this case, you must configure the capabilities to recycle zombie processes in the startup command.

  • You can use Bash scripts to start programs. Bash processes have the abilities to recycle zombie processes. For example, you can configure Startup Command as /code/start.sh. The following code snippet shows the content of start.sh.

    #! /bin/bash
    python /code/app.py 
  • If you use Serverless Devs or call an API operation, you can name the startup script as bootstrap without the need to configure Startup Command. In a function that does not have Startup Command configured, Function Compute attempts to start the function by using the /code/bootstrap script.