nginx resource_error ai_generated true

写入客户端请求体临时文件失败(28:设备上无剩余空间)

client_body_temp_file_write() failed (28: No space left on device) while reading client request body

ID: nginx/client-body-temp-file-write-failed

其他格式: JSON · Markdown 中文 · English
95%修复率
92%置信度
1证据数
2024-01-10首次发现

版本兼容性

版本状态引入弃用备注
nginx-1.24.0 active
nginx-1.25.3 active
nginx-1.26.0 active

根因分析

nginx 存储客户端请求体临时文件的分区(通常是 /var/lib/nginx/tmp 或 /tmp)已满。

English

The filesystem partition where nginx stores temporary client body files (usually /var/lib/nginx/tmp or /tmp) is full.

generic

官方文档

https://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_temp_path

解决方案

  1. Free up space on the partition or move the temp directory to a partition with more space. Example:
    sudo du -sh /var/lib/nginx/tmp
    sudo rm -rf /var/lib/nginx/tmp/*
    # Or change path in nginx.conf:
    client_body_temp_path /data/nginx/tmp 1 2;
  2. Increase the partition size if using LVM or cloud storage. For example, on AWS EBS, extend the volume and resize the filesystem.

无效尝试

常见但无效的做法:

  1. 60% 失败

    The buffer only delays temp file creation; large requests will still hit disk.

  2. 50% 失败

    It forces all body data into memory, which can cause OOM for large uploads.

  3. 80% 失败

    Nginx will fail to create the temp directory and return a permission denied error.