timmyyao commented on code in PR #10536:
URL: https://github.com/apache/paimon/pull/10536#discussion_r4258052819


##########
paimon-python/pypaimon/filesystem/jindo_file_system_handler.py:
##########
@@ -131,9 +131,16 @@ def create_jindo_oss_filesystem(root_uri: str, 
catalog_options: Options):
 
 
 class JindoInputFile:
-    def __init__(self, jindo_stream, file_size=None):
+    def __init__(self, jindo_stream, file_size=None, owner=None):
         self._stream = jindo_stream
         self._file_size = file_size
+        # Back-reference keeping the handler (and its native JindoSDK
+        # connection) alive: the stream is a non-owning reference into memory
+        # owned by handler._jindo_fs. Without it, dropping the FileIO that
+        # holds the handler (e.g. RESTTokenFileIO's TTLCache maxsize=1
+        # eviction on token refresh) frees the native connection while other
+        # threads still read from this stream.
+        self._owner = owner

Review Comment:
   done



##########
paimon-python/pypaimon/filesystem/jindo_file_system_handler.py:
##########
@@ -373,20 +383,20 @@ def open_input_stream(self, path: str):
         normalized = self._normalize_path(path)
         jindo_stream = self._jindo_fs.open(normalized, "rb")
         return PythonFile(
-            JindoInputFile(jindo_stream, self._known_file_size(normalized)),
+            JindoInputFile(jindo_stream, self._known_file_size(normalized), 
owner=self),

Review Comment:
   done



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to