Repository navigation
[core] (FreeObjects 3/n) Gut internal free - #64037
Conversation
Signed-off-by: aaron.li <[email protected]>
Signed-off-by: aaron.li <[email protected]>
Signed-off-by: aaron.li <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request removes the deprecated internal free API and the associated OBJECT_FREED error across Python, Java, and C++ components, including the removal of eager memory deallocation logic in Ray Data. The review feedback highlights a potential Java compilation failure due to a missing update in InternalApi.java, recommends reserving the deleted protobuf tag in SpillObjectsRequest to maintain wire compatibility, and suggests keeping eager_free as a deprecated attribute in DataContext to prevent backward-compatibility issues.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
…nternal-free # Conflicts: # ci/lint/pydoclint-baseline.txt # python/ray/_private/internal_api.py # python/ray/data/_internal/block_batching/iter_batches.py
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
|
unstale |
| // using the internal free() call. We will only recover this object if it is | ||
| // needed for reconstruction of another downstream object. | ||
| // using the internal free() call. This call is now deprecated, but we still | ||
| // keep this error for backwards compatibility. |
Sparks0219
left a comment
There was a problem hiding this comment.
LGTM, can you approve the data changes @goutamvenkat-anyscale? 🙏
…nternal-free Signed-off-by: Aaron <[email protected]> # Conflicts: # python/ray/data/_internal/block_batching/iter_batches.py # python/ray/data/context.py # python/ray/data/iterator.py # python/ray/data/tests/test_zip.py
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 502f299. Configure here.
## Description There is currently a method `_internal.free` that explicitly frees a ref's objects' copies across the cluster (primary and secondary). This calls into the FreeObjects path that then frees the primary copy and broadcasts frees to other nodes (if `local_only`=false). For more information on this, please read ray-project#63218. In the new implementation of FreeObjects, we remove this broadcast, which means all copies will only be locally deleted now. This introduces slight regression (although secondary copies will eventually be evicted). Since `_internal.free` has been deprecated for ~11 months now, the decision is made to just remove it. ## Current Use Case Considerations ### Ray Data Split Ray Data in one use case touches upon internal free. However, the default case for the internal free codepath is usually `false`. Furthermore, it seems that they do not necessarily need this functionality and can just wait for object free. There ends up being a lot of cleanups for Ray Data because of flags that are no longer necessary due to the removal of this codepath. All these flags are defaulted to false. ### Java Internal Free Java runtime also has an internal free implementation that plumbs into the same codepath as cython. We decide to not support multi-language runtimes, and thus do not want to continue supporting this. ### Out of Band Serialization / Deserialization There is current support for out of band serialization / deserialization through cloudpickle, which would then rely on internal free for freeing the underlying object. We do not want to continue supporting this, and thus remove this. ### Testing Usecases Some testing use cases who only test adjacent conditions have maintained functionality. However, some test cases that purely test `_internal.free` or are largely coupled with `_internal.free` are removed. --------- Signed-off-by: aaron.li <[email protected]> Co-authored-by: aaron.li <[email protected]> Co-authored-by: Aaron <[email protected]> Signed-off-by: 400Ping <[email protected]>
## Description There is currently a method `_internal.free` that explicitly frees a ref's objects' copies across the cluster (primary and secondary). This calls into the FreeObjects path that then frees the primary copy and broadcasts frees to other nodes (if `local_only`=false). For more information on this, please read ray-project#63218. In the new implementation of FreeObjects, we remove this broadcast, which means all copies will only be locally deleted now. This introduces slight regression (although secondary copies will eventually be evicted). Since `_internal.free` has been deprecated for ~11 months now, the decision is made to just remove it. ## Current Use Case Considerations ### Ray Data Split Ray Data in one use case touches upon internal free. However, the default case for the internal free codepath is usually `false`. Furthermore, it seems that they do not necessarily need this functionality and can just wait for object free. There ends up being a lot of cleanups for Ray Data because of flags that are no longer necessary due to the removal of this codepath. All these flags are defaulted to false. ### Java Internal Free Java runtime also has an internal free implementation that plumbs into the same codepath as cython. We decide to not support multi-language runtimes, and thus do not want to continue supporting this. ### Out of Band Serialization / Deserialization There is current support for out of band serialization / deserialization through cloudpickle, which would then rely on internal free for freeing the underlying object. We do not want to continue supporting this, and thus remove this. ### Testing Usecases Some testing use cases who only test adjacent conditions have maintained functionality. However, some test cases that purely test `_internal.free` or are largely coupled with `_internal.free` are removed. --------- Signed-off-by: aaron.li <[email protected]> Co-authored-by: aaron.li <[email protected]> Co-authored-by: Aaron <[email protected]>
Master converted the Ray Core user guide to MyST Markdown (ray-project#66430) and moved it from doc/source/ray-core to doc/source/core (ray-project#66605), so the .rst edits from this PR no longer apply. Re-apply them to the .md pages: - core/patterns/out-of-band-object-ref-serialization.md: add the intro paragraph naming both out-of-band channels, retitle the existing example as "pickle and cloudpickle", and add the "hex string round-trip" section that includes the doc_code example. - core/objects/serialization.md: the "Serializing ObjectRefs" section that held the seealso was removed in ray-project#64037, so add the cross-link as a bullet under "Serialization notes" instead. The doc_code example moved with the directory rename and is unchanged. Signed-off-by: Gaurav Dubey <[email protected]>

Description
There is currently a method
_internal.freethat explicitly frees a ref's objects' copies across the cluster (primary and secondary). This calls into the FreeObjects path that then frees the primary copy and broadcasts frees to other nodes (iflocal_only=false). For more information on this, please read #63218. In the new implementation of FreeObjects, we remove this broadcast, which means all copies will only be locally deleted now. This introduces slight regression (although secondary copies will eventually be evicted). Since_internal.freehas been deprecated for ~11 months now, the decision is made to just remove it.Current Use Case Considerations
Ray Data Split
Ray Data in one use case touches upon internal free. However, the default case for the internal free codepath is usually
false. Furthermore, it seems that they do not necessarily need this functionality and can just wait for object free. There ends up being a lot of cleanups for Ray Data because of flags that are no longer necessary due to the removal of this codepath. All these flags are defaulted to false.Java Internal Free
Java runtime also has an internal free implementation that plumbs into the same codepath as cython. We decide to not support multi-language runtimes, and thus do not want to continue supporting this.
Out of Band Serialization / Deserialization
There is current support for out of band serialization / deserialization through cloudpickle, which would then rely on internal free for freeing the underlying object. We do not want to continue supporting this, and thus remove this.
Testing Usecases
Some testing use cases who only test adjacent conditions have maintained functionality. However, some test cases that purely test
_internal.freeor are largely coupled with_internal.freeare removed.