From 475c125dc2caa91175d73ba6b0cf4acb5f6ebc1f Mon Sep 17 00:00:00 2001 From: David Gardner Date: Fri, 20 Sep 2024 08:28:41 -0700 Subject: [PATCH] Import pypdfium2 early to ensure the cleanup method is called after our after_pipeline callback --- examples/llm/cli.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/llm/cli.py b/examples/llm/cli.py index c8aea20320..cf81557bfd 100644 --- a/examples/llm/cli.py +++ b/examples/llm/cli.py @@ -16,6 +16,10 @@ import time import click +# pypdfium2 utilizes an atexit handler to perform cleanup, importing here to ensure that handler is registered before +# after_pipeline is, and thus is executed after after_pipeline is invoked. This avoids memory leak warnings at shutdown. +# https://github.com/nv-morpheus/Morpheus/issues/1864 +import pypdfium2 # pylint: disable=unused-import # noqa: F401 from llm.agents import run as run_agents from llm.completion import run as run_completion