linrrzqqq commented on code in PR #69255:
URL: https://github.com/apache/doris/pull/69255#discussion_r4310824410
##########
be/src/udf/python/python_server.py:
##########
@@ -1113,39 +1024,7 @@ def _get_or_import_module(self, location: str,
full_module_name: str) -> Any:
f"server-critical modules."
)
- cache_key = location
-
- # Use a per-module lock to prevent race conditions during import
- import_lock = ModuleUDFLoader._get_import_lock(full_module_name)
-
- with import_lock:
- # Fast path: check cache first
- if cache_key in ModuleUDFLoader._module_cache:
- cached_module = ModuleUDFLoader._module_cache[cache_key]
- if cached_module is not None and (
- hasattr(cached_module, "__file__")
- or hasattr(cached_module, "__path__")
- ):
- return cached_module
- else:
- del ModuleUDFLoader._module_cache[cache_key]
-
- self._clear_modules_from_sys(full_module_name)
-
- with temporary_sys_path(location):
- try:
- module = importlib.import_module(full_module_name)
- ModuleUDFLoader._module_cache[cache_key] = module
- # Evict from sys.modules so future imports from a
- # different location are not poisoned by this one.
- self._clear_modules_from_sys(full_module_name)
- return module
- except Exception:
- # Clean up any partially-imported modules
- self._clear_modules_from_sys(full_module_name)
- if cache_key in ModuleUDFLoader._module_cache:
- del ModuleUDFLoader._module_cache[cache_key]
- raise
+ return importlib.import_module(full_module_name)
Review Comment:
Users should pay attention to avoid this situation.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]