[
https://issues.apache.org/jira/browse/OPENNLP-1840?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Martin Wiesner updated OPENNLP-1840:
------------------------------------
Affects Version/s: 3.0.0-M3
2.5.9
> NameFinderDL leaks native ONNX resources on every find() call
> -------------------------------------------------------------
>
> Key: OPENNLP-1840
> URL: https://issues.apache.org/jira/browse/OPENNLP-1840
> Project: OpenNLP
> Issue Type: Bug
> Components: dl, Name Finder
> Affects Versions: 2.5.9, 3.0.0-M3
> Reporter: Kristian Rickert
> Assignee: Kristian Rickert
> Priority: Major
> Fix For: 2.5.10, 3.0.0-M4
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> {{NameFinderDL.find()}} creates up to three {{OnnxTensor}} inputs
> ({{input_ids}}, {{attention_mask}}, {{token_type_ids}}) and an
> {{OrtSession.Result}} per sentence chunk, but never closes them. Each call
> therefore accumulates off-heap native memory that is only reclaimed when the
> process exits -- the same defect fixed for {{SentenceVectorsDL}} in
> OPENNLP-1836 and {{DocumentCategorizerDL}} in OPENNLP-1839.
> Long-running services invoking {{find()}} repeatedly will grow native memory
> unbounded until the process is OOM-killed, while the Java heap looks healthy.
> The fix is the established pattern: close the input tensors in a {{finally}}
> block and the {{OrtSession.Result}} via try-with-resources ({{getValue()}}
> copies into Java arrays first, so closing is safe).
> {{NameFinderDL.tokenize()}} also has the same auto-unboxing
> {{NullPointerException}} on vocabulary misses ({{vocab.get(tokens[x])}} into
> {{int}}) that OPENNLP-1839 fixed for {{DocumentCategorizerDL}}; it should
> throw a descriptive {{IllegalArgumentException}} instead.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)