Skip to content

ExecutorManager can fail to import a freshly written UDF module with ModuleNotFoundError because importlib caches are not invalidated #7126

Closed

Description

@Yicong-Huang

What happened?

ExecutorManager.load_executor_definition writes the UDF code to a new module file on its tmp filesystem and immediately calls importlib.import_module, without calling importlib.invalidate_caches() first. Python's FileFinder caches each directory listing keyed on the directory's mtime. When two executor updates land within the filesystem's timestamp granularity, the second module file is invisible to the import system and import_module raises ModuleNotFoundError (e.g. No module named 'udf-v21'). Expected: every initialize_executor / update_executor call imports the module it just wrote — the Python docs require invalidate_caches() after creating a module file at runtime.

How to reproduce?

Call update_executor twice in quick succession so both module files are written within the filesystem's mtime granularity window; the second import fails. src/test/python/core/architecture/managers/test_executor_manager.py::TestUpdateExecutor::test_repeated_updates_keep_carrying_the_running_state reproduces this reliably on filesystems with coarse mtime resolution (e.g. overlayfs); on ext4 it depends on timing.

Version/Branch

1.3.0-incubating-SNAPSHOT (main)

Commit Hash (Optional)

ebfd1db

Relevant log output

FAILED src/test/python/core/architecture/managers/test_executor_manager.py::TestUpdateExecutor::test_repeated_updates_keep_carrying_the_running_state - ModuleNotFoundError: No module named 'udf-v21'

Activity

  1. added theissue type on Jul 30, 2026
  2. Neilk1021 commented on Jul 31, 2026

    @Neilk1021
    Contributor

    /take

  3. added a commit that references this issue on Jul 31, 2026
    24a20c8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions