You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gluten.apache.org by "zhztheplayer (via GitHub)" <gi...@apache.org> on 2025/04/28 14:20:39 UTC

[PR] Add additional logging for unclosed objects when the native runtime is being destroyed [incubator-gluten]

zhztheplayer opened a new pull request, #9455:
URL: https://github.com/apache/incubator-gluten/pull/9455

   The change is ported from https://github.com/velox4j/velox4j/pull/152.
   
   The logging message is like:
   
   ```
   I20250428 16:15:48.877297 446254 ObjectStore.cc:34] Unclosed object [Store ID: 4, Resource handle ID: 4, Description: i] is found when object store is closing. Gluten will destroy it automatically but it's recommended to manually close the object through the Java closing API after use, to minimize peak memory pressure of the application.
   ```
   
   The log is on verbose level 2.
   
   In the future, addressing these unclosed objects in code may reduce the peak off-heap memory usage of Gluten.
   
   


-- 
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@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Add additional logging for unclosed objects when the native runtime is being destroyed [incubator-gluten]

Posted by "ArnavBalyan (via GitHub)" <gi...@apache.org>.
ArnavBalyan commented on code in PR #9455:
URL: https://github.com/apache/incubator-gluten/pull/9455#discussion_r2063817634


##########
cpp/core/utils/ObjectStore.h:
##########
@@ -70,7 +70,14 @@ class ObjectStore {
     return storeId_;
   }
 
-  ObjectHandle save(std::shared_ptr<void> obj);
+  template <typename T>
+  ObjectHandle save(std::shared_ptr<T> obj) {
+    const std::lock_guard<std::mutex> lock(mtx_);
+    const std::string_view description = typeid(T).name();

Review Comment:
   nit: Would it help to add sizeof(T) along with the name in description



-- 
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@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Add additional logging for unclosed objects when the native runtime is being destroyed [incubator-gluten]

Posted by "ArnavBalyan (via GitHub)" <gi...@apache.org>.
ArnavBalyan commented on code in PR #9455:
URL: https://github.com/apache/incubator-gluten/pull/9455#discussion_r2063930106


##########
cpp/core/utils/ObjectStore.h:
##########
@@ -70,7 +70,14 @@ class ObjectStore {
     return storeId_;
   }
 
-  ObjectHandle save(std::shared_ptr<void> obj);
+  template <typename T>
+  ObjectHandle save(std::shared_ptr<T> obj) {
+    const std::lock_guard<std::mutex> lock(mtx_);
+    const std::string_view description = typeid(T).name();

Review Comment:
   May help with better debugging if the size of object is also visible along with the name, probably can be avoided if performance can be an issue



-- 
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@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] Add additional logging for unclosed objects when the native runtime is being destroyed [incubator-gluten]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #9455:
URL: https://github.com/apache/incubator-gluten/pull/9455#issuecomment-2835421895

   <!--
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
     regarding copyright ownership.  The ASF licenses this file
     to you under the Apache License, Version 2.0 (the
     "License"); you may not use this file except in compliance
     with the License.  You may obtain a copy of the License at
   
       http://www.apache.org/licenses/LICEGJ-2.0
   
     Unless required by applicable law or agreed to in writing,
     software distributed under the License is distributed on an
     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
   -->
   
   Thanks for opening a pull request!
   
   Could you open an issue for this pull request on Github Issues?
   
   https://github.com/apache/incubator-gluten/issues
   
   Then could you also rename ***commit message*** and ***pull request title*** in the following format?
   
       [GLUTEN-${ISSUES_ID}][COMPONENT]feat/fix: ${detailed message}
   
   See also:
   
     * [Other pull requests](https://github.com/apache/incubator-gluten/pulls/)
   
   


-- 
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@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Add additional logging for unclosed objects when the native runtime is being destroyed [incubator-gluten]

Posted by "zhztheplayer (via GitHub)" <gi...@apache.org>.
zhztheplayer merged PR #9455:
URL: https://github.com/apache/incubator-gluten/pull/9455


-- 
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@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Add additional logging for unclosed objects when the native runtime is being destroyed [incubator-gluten]

Posted by "zhztheplayer (via GitHub)" <gi...@apache.org>.
zhztheplayer commented on code in PR #9455:
URL: https://github.com/apache/incubator-gluten/pull/9455#discussion_r2063906727


##########
cpp/core/utils/ObjectStore.h:
##########
@@ -70,7 +70,14 @@ class ObjectStore {
     return storeId_;
   }
 
-  ObjectHandle save(std::shared_ptr<void> obj);
+  template <typename T>
+  ObjectHandle save(std::shared_ptr<T> obj) {
+    const std::lock_guard<std::mutex> lock(mtx_);
+    const std::string_view description = typeid(T).name();

Review Comment:
   Not sure but performance might be an issue. Any specific reason for adding it?



-- 
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@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Add additional logging for unclosed objects when the native runtime is being destroyed [incubator-gluten]

Posted by "zhztheplayer (via GitHub)" <gi...@apache.org>.
zhztheplayer commented on code in PR #9455:
URL: https://github.com/apache/incubator-gluten/pull/9455#discussion_r2063944469


##########
cpp/core/utils/ObjectStore.h:
##########
@@ -70,7 +70,14 @@ class ObjectStore {
     return storeId_;
   }
 
-  ObjectHandle save(std::shared_ptr<void> obj);
+  template <typename T>
+  ObjectHandle save(std::shared_ptr<T> obj) {
+    const std::lock_guard<std::mutex> lock(mtx_);
+    const std::string_view description = typeid(T).name();

Review Comment:
   > May help with better debugging if the size of object is also visible along with the name, probably can be avoided if performance can be an issue
   
   Yes performance could be affected if we create a new `std::string` from the typeid and size. But we can make a new struct type consisting of `string_view` and the size type which is less expensive. Think we can do that separately in another PR so feel free to follow up.



-- 
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@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org