[ 
https://issues.apache.org/jira/browse/CAMEL-27216?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Work on CAMEL-27216 started by shashank.
----------------------------------------
> camel-cassandraql - stopping an idempotent, aggregation or key-value 
> repository closes the CqlSession it was given
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27216
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27216
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-cassandraql
>            Reporter: shashank
>            Assignee: shashank
>            Priority: Major
>
> h3. What happens
> {{CassandraIdempotentRepository}}, {{CassandraAggregationRepository}} and 
> {{CassandraKeyValueRepository}} (and the {{Named}} variants) get the 
> {{CqlSession}} to use from the application, and keep it in a 
> {{CassandraSessionHolder}}. The holder has a {{managedSession}} flag 
> ("whether the session is externally managed"), but its only constructor sets 
> it to {{false}}, so the stop of the repository closes the session and sets it 
> to null:
> * the session of the application is closed when the repository stops, such as 
> when its route is removed (route reload) or the CamelContext stops: the cql 
> endpoints, repositories and application code that use the same session fail 
> with "Session is closed";
> * the repository cannot be started again: the start prepares its statements 
> on a null session ({{NullPointerException}}), so the route fails to start 
> after a route reload.
> h3. How to reproduce
> {{CassandraRepositoriesSessionTest}} (camel-cassandraql, mocked 
> {{CqlSession}}): each repository is started, stopped and started again: the 
> session is closed by the stop, and the second start fails.
> h3. Fix
> The holder of a given session marks it as managed outside, so the 
> repositories never close it; the application closes it, as it does for any 
> session it creates.
> _Filed with Claude Code on behalf of allthingssecurity._



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

Reply via email to