Help Center/ ModelArts/ Troubleshooting/ DevEnviron/ Instance Faults/ Notebook Instance Restarts Unexpectedly
Updated on 2026-11-10 GMT+08:00

Notebook Instance Restarts Unexpectedly

Symptom

In the Event tab of the notebook details page, view the event information about the container restart. An instance status changes to Error and then automatically recovers, a running instance restarts abruptly, or an instance fails to be created, and "JupyterProcessKilled" or "OOMKilled" is displayed.

Locating Method

After a notebook instance is restarted, perform the following steps to check whether resources (such as CPU and memory) are used up:

  1. View the monitoring on the console and check the resource usage before the restart.
    1. Log in to the ModelArts console. In the Monitor tab (or JupyterLab resource monitoring) of the notebook instance details page, view the CPU and physical memory usage of the instance, and check whether resources are used up before the restart.
      For details about the metrics, see Checking the Resource Usage of a Notebook Instance and Monitoring Resources.
      Figure 1 CPU usage increase curve (Monitor tab)
      Figure 2 Physical memory usage increase curve (JupyterLab resource monitoring)
    2. Log in to the notebook instance and run system commands to check the resource usage.

      Command

      Description

      top

      View the CPU usage, physical memory usage, and processes that occupy the most resources. For the top command, processes are sorted by CPU usage by default. After entering the interface, you can press M to sort processes by memory usage to quickly locate processes with high usage.

      free -h

      View the total, used, and available memory to check whether the specification upper limit is about to be reached.

      df -h /cache

      Check whether the usage of the /cache directory exceeds the size limits of the current specifications.

      ps aux --sort=-%cpu | head

      Sort the processes by CPU usage to help locate abnormal processes.

    3. View the event information of the notebook instance to determine the restart type.

      In the Event tab of the notebook instance details page, view the specific event and determine the restart type based on the examples.

      • If "JupyterProcessKilled" is displayed, key processes are most likely to be cleared, or the custom image configuration is incorrect. For details, see Cause 2 and Cause 3.
        Figure 3 JupyterProcessKilled event example
      • If "OutOfMemory" is displayed, the memory usage exceeds the threshold. For details, see Cause 1.
        Figure 4 OutOfMemory event example
      • If "FailedToStartContainer" (for example, "Failed to start container. Please contact SRE to check node...") is displayed, the container fails to be started. In this case, contact SRE to check the node.
        Figure 5 FailedToStartContainer event example

Possible Causes

The possible causes of automatic restart of a notebook instance are classified into the three types below based on user behaviors. The triggering mechanism is described in each item.

  • Cause 1: The instance is overloaded.

    Resource-intensive tasks are executed or large-volume data is loaded in a notebook instance, causing resource exhaustion or exceptions. By triggering mechanism:

    • OOM rebuilding triggered by insufficient memory: The data volume is too large during code runtime, there are too many model training layers, or the /cache directory usage exceeds the size limits of instance specifications. As a result, the container memory usage exceeds the upper limit of instance specifications. The container directly triggers the OOM mechanism to terminate and rebuild the container ("OutOfMemory" or "OOMKilled" is displayed), and the status changes to Error. This type of restart is directly triggered by the resource layer.
    • Health check failure caused by CPU overload: Running resource-intensive tasks and performing high-I/O operations in the development environment causes CPU overload, slowing down critical processes and preventing them from passing heartbeat checks. The system then marks it as unhealthy and triggers an automatic restart.
    • Health check failure caused by port leakage: User programs fail to properly close network connections or continuously open a large number of ports, exhausting port resources. As a result, key processes cannot respond normally, and health check failures trigger an automatic restart. For details about how to check for port leakage, see Fault Locating.
  • Cause 2: Key processes are killed.

    When you manually kill key processes such as JupyterLab, sshd, and Code Server ("JupyterProcessKilled" is displayed), the health check fails and the notebook instance automatically restarts.

  • Cause 3: Incorrect custom image configuration, causing the creation failure and triggering a restart

    The custom image is incorrectly configured. As a result, key processes of the image cannot be started in the container, and the instance fails to be created and restarts repeatedly.

    • Inconsistent architecture or type: When you register a custom image on the Image Management page of ModelArts, Architecture (Arm/x86) or Type is not that of the source image.
    • Special environment variable configuration: You have specially configured the image, for example, you have set BASH_ENV. As a result, key processes fail to start.

Solution

  • For cause 1 (overloaded instance):
    • Migrate resource-intensive tasks: Migrate compute-intensive and training workloads to the training environment, and use notebook instances only for debugging, avoiding resource overload.
    • Use higher specifications: If the current specifications cannot meet your requirements, upgrade to higher specifications for the notebook instance or create one with higher specifications. For details, see Changing the Specifications of a Notebook Instance and Creating a Notebook Instance.
    • Reduce concurrency: Reduce concurrency and control resource consumption.
    • Properly use the storage directory: Use /home/ma-user/work to store data. This prevents the usage of the /cache directory from exceeding the size limits of the current instance specifications.
    • Check for port leakage: Check whether there are unclosed network connections or numerous ports that are continuously enabled in the user program, and rectify the connection leakage fault.
  • For cause 2 (key processes are killed):

    Check for process exceptions: Check whether the restart is caused by manually killing key processes such as JupyterLab, sshd, and Code Server. Do not manually kill key processes.

  • For cause 3 (incorrect custom image configuration):

    Check the custom image: Ensure that Architecture (Arm/x86) and Type of the custom image are the same as those of the source image. Check whether the process startup exception is caused by special environment variable configuration (for example, BASH_ENV). If yes, rectify the fault, register the image again, and create a notebook instance. For details, see Image Registration and Management.

Automatic restart of notebook instances is a system self-recovery mechanism. It only restores the instance status but does not resolve the root cause. If the exception persists after the restart, check the previous causes one by one.