Andrea Cosentino created CAMEL-24529:
----------------------------------------

             Summary: camel-djl: the loaded ZooModel is never closed 
(native-memory leak on restart)
                 Key: CAMEL-24529
                 URL: https://issues.apache.org/jira/browse/CAMEL-24529
             Project: Camel
          Issue Type: Bug
          Components: camel-ai
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino
             Fix For: 4.23.0


DJL zoo predictors load a ZooModel (ModelZoo.loadModel) in their constructor, 
but DJLProducer has no doStop() and AbstractPredictor has no close(), so the 
native ZooModel (NDManager/engine memory) is never released on route 
stop/redeploy or CamelContext restart — a native-memory leak. The huggingface 
sibling cleans up (AbstractTaskPredictor.close via HuggingFaceProducer.doStop). 
The per-exchange Predictor objects are correctly try-with-resources; only the 
model is leaked.

Fix: add close() to AbstractPredictor (closing the model), keep the predictor 
reference in DJLProducer, and override DJLProducer.doStop() to close it.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to