Andrea Cosentino created CAMEL-24520:
----------------------------------------

             Summary: camel-ibm-watsonx-ai: lazy service getters on 
WatsonxAiEndpoint are not thread-safe
                 Key: CAMEL-24520
                 URL: https://issues.apache.org/jira/browse/CAMEL-24520
             Project: Camel
          Issue Type: Bug
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino
             Fix For: 4.23.0


WatsonxAiEndpoint creates each watsonx.ai service lazily in its getter (for 
example getChatService(): if (chatService == null) chatService = 
WatsonxAiServiceFactory.createChatService(configuration);). The lazy 
initialization is intentional (avoid building service clients that an endpoint 
never uses, and avoid creating them on a started context) but is not 
synchronized, so two threads calling a getter concurrently on first use can 
both build a client; one is then leaked. Make the lazy getters thread-safe 
(synchronized) while keeping the lazy creation.\n\nAffected: 
components/camel-ibm/camel-ibm-watsonx-ai 
(org.apache.camel.component.ibm.watsonx.ai.WatsonxAiEndpoint service getters).



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

Reply via email to