python / python/cpython

Fix portability of `sendfile(2)` support detection for Lustre filesystems

未關閉
#139,416 0 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

3.13 3.14 3.15 stdlib type-bug
主要語言
Python
星號
77.2k
分支
35.9k
PR 合併指標
PR 指標待擷取

描述

Bug report

Bug description:

On Lustre on Linux (specifically the AWS implementation) there is a rare and difficult to reproduce failure of shutil.copyfile in its sendfile(2) fast path because the syscall returns ENODATA. The situation is recoverable by falling back to the standard read/write file copy (patch forthcoming).

Reproducing the bug requires the filesystem to be in a specific state which I have not been able to reproduce at will but we've seen it on occasions by multiple users. Additionally similar bug has been seen on rust fs::copy which similarly does not trap the ENODATA error.

Following is sufficient to reproduce bug for the specific (rare) file that fails:

import shutil
shutil.copyfile('src', 'dst')

error:

sent = os.sendfile(outfd, infd, offset, blocksize)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 61] No data available: '/shared/fsx1/filename' 
CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs
  • gh-139417

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 shutil.copyfile 的 sendfile 快速路徑開始,檢查如何處理 os.sendfile 錯誤。在受影響的檔案系統上使用 shutil.copyfile('src', 'dst') 重現該失敗;當 ENODATA 失敗回退到標準的讀取/寫入複製路徑時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
linux, python
領域
operating-systems
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。