[ 
https://issues.apache.org/jira/browse/CAMEL-27870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18153219#comment-18153219
 ] 

Guillaume Nodet commented on CAMEL-27870:
-----------------------------------------

This issue is being investigated by a coding agent (on behalf of gnodet).

Root cause confirmed: BeanValidatorEndpoint.createProducer() builds a new 
ValidatorFactory via ValidatorFactories.buildValidatorFactory() when none is 
user-supplied, but neither the endpoint nor BeanValidatorProducer ever calls 
close() on it. ValidatorFactory implements Closeable, so this is a resource 
leak per producer created. No doStop()/doShutdown() exists in either class.

Fix: add doStop() override in BeanValidatorProducer to close the factory when 
it was internally built (not user-supplied).

_Note: This comment was generated by an AI coding agent and requires manual 
verification._

> camel-bean-validator: a ValidatorFactory built by the endpoint is never closed
> ------------------------------------------------------------------------------
>
>                 Key: CAMEL-27870
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27870
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-bean-validator
>            Reporter: Claus Ibsen
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-bean-validator for 
> CAMEL-23832 (commit 
> https://github.com/apache/camel/commit/1aaff12f7925110d68d6576bdc6977b75773cc4a,
>  pull request https://github.com/apache/camel/pull/31146).
> This is a separate problem of the component; the descriptions change only 
> documents the current behavior.
> h4. The built ValidatorFactory is never closed
> {{BeanValidatorEndpoint.createProducer}} builds a ValidatorFactory 
> (ValidatorFactories.buildValidatorFactory) when none is set, but nothing 
> calls close() on it, so its caches leak for each producer.
> Proposed change: close it in doStop when the producer built it (never one the 
> user supplied).
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to