XDRIVE: S3兼容存储因先删除非空父目录再删子文件报错412

Open Beginner friendly
#7,428 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@earmark-halt is already working on this.

Since Nov 17, 2026.

  • #7439 by @earmark-halt — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
aws, go
Domain
backend, cloud

Research direction

Read transport/internet/xdrive/s3.go around lines 490–518, where the issue says abandoned-session cleanup deletes parent directories before their child files. Check the deletion order against S3-compatible storage behavior, then inspect nearby tests for cleanup coverage. Done means garbage collection no longer sends a delete for a non-empty parent before deleting its children, avoiding the reported 412 response.

Written by the indexing model from the issue text.

Description

完整性要求
  • 我读完了 issue 模板中的所有注释,确保填写符合要求。
  • 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • 我提供了完整的配置文件和日志,而不是出于自己的判断只给出截取的部分。
  • 我搜索了 issues, 没有发现已提出的类似问题。
  • 问题在 Release 最新的版本上可以成功复现
描述

有一些S3兼容存储因先删父目录再删子文件报错412,因为他们不允许删除非空目录,导致垃圾回收一直失败:

[Warning] transport/internet/xdrive: failed to collect abandoned sessions > transport/internet/xdrive: S3 DELETE answered 412

相关代码如下:
https://github.com/XTLS/Xray-core/blob/v26.11.9/transport/internet/xdrive/s3.go#L490-L518

重现方式

逻辑问题,无需重现

客户端配置

{
  "tag": "xdrive-out",
  "protocol": "vless",
  "settings": {
    "address": "127.0.0.1",
    "port": 10000,
    "id": "xxx",
    "encryption": "xxx"
  },
  "streamSettings": {
    "network": "xdrive",
    "security": "none",
    "xdriveSettings": {
      "service": "s3",
      "remoteFolder": "xxx",
      "secrets": [
        "xxx",
        "xxx"
      ],
      "s3": {
        "endpoint": "https://s3.example.com",
        "region": "xxx",
        "bucket": "xxx",
        "pathStyle": true
      }
    }
  },
  "mux": {
    "enabled": true
  }
}
服务端配置

        {
            "tag": "xdrive",
            "listen": "127.0.0.1",
            "port": 10000,
            "protocol": "vless",
            "settings": {
                "clients": [
                    {
                        "id": "xxx"
                    }
                ],
                "decryption": "xxx"
            },
            "streamSettings": {
                "network": "xdrive",
                "xdriveSettings": {
                    "service": "s3",
                    "remoteFolder": "xxx",
                    "secrets": [
                        "xxx",
                        "xxx"
                    ],
                    "s3": {
                        "endpoint": "https://s3.example.com",
                        "region": "xxx",
                        "bucket": "xxx",
                        "pathStyle": true
                    }
                }
            }
        }
客户端日志

无

服务端日志

[Warning] transport/internet/xdrive: failed to collect abandoned sessions > transport/internet/xdrive: S3 DELETE answered 412

Dominant language
Go
Stars
43.3k
Forks
6.2k
Avg merge
2d 11h
Merged PRs (30d)
55

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from XTLS/Xray-core

All issues in XTLS/Xray-core

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.