You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2026/09/09 06:37:00 UTC

[PR] fix(bindings/python): release GIL during blocking File I/O [opendal]

Xuanwo opened a new pull request, #8267:
URL: https://github.com/apache/opendal/pull/8267

   # Which issue does this PR close?
   
   Addresses the remaining blocking File GIL work in #8159. Related to #6859, which proposed GIL release against the older File implementation.
   
   # Rationale for this change
   
   Blocking File operations hold the GIL while waiting for storage, preventing unrelated Python threads from progressing. Operator I/O already releases it.
   
   # What changes are included in this PR?
   
   Release the GIL around File reads, writes, seeks, flushes, and close, including context-manager exit. Keep the File's exclusive mutable borrow throughout each operation and retain immutable Python bytes during writes. `readinto` waits using an owned OpenDAL Buffer and copies into the exported Python buffer after reattaching, without exposing a raw writable pointer during I/O. Failed close operations leave the File open.
   
   Coordinated HTTP subprocess tests verify Python-thread progress during blocked I/O, exclusion of concurrent File operations, and close failure state. Buffer tests cover writable slices, rejected buffers, cursor advancement, and EOF.
   
   Validation of this change on macOS ARM64:
   
   - CPython 3.14.7, free-threaded CPython 3.14.7 with the GIL disabled, and CPython 3.11.16 with abi3: each passed 36 tests with 1 capability-based skip across `test_sync_gil.py`, `test_read.py`, and `test_write.py`.
   - All seven new File GIL cases fail against baseline `37ac1d79efd46aec8da3ac19fb3624e25111c2e6`.
   - Rust formatting, Ruff, and focused library Clippy passed. All-target Clippy is blocked by the existing `items_after_test_module` warning in `src/utils.rs`.
   
   The coordinated server tests exercise the binding's GIL behavior; they do not establish a service-specific fix or measure throughput. Blocking write/flush waits are not independently gated by these tests.
   
   # Are there any user-facing changes?
   
   Other Python threads can run while File storage I/O waits. Concurrent operations on the same File are rejected; applications should use separate File objects across threads. Python method signatures remain unchanged.
   
   # AI Usage Statement
   
   AI assisted implementation, regression tests, and validation under human direction and review. No throughput improvement is claimed.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(bindings/python): release GIL during blocking File I/O [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo merged PR #8267:
URL: https://github.com/apache/opendal/pull/8267


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org