oscerd opened a new issue, #1800:
URL: https://github.com/apache/camel-kafka-connector/issues/1800
## Description
Two problems in the bundled type-converter SMT.
**1. `static` field assigned from an instance method**
`core/src/main/java/org/apache/camel/kafkaconnector/transforms/CamelTypeConverterTransform.java`
declares the converter as `static` (line 39) but assigns it from the
per-instance `configure()`
(line 95):
```java
private static TypeConverter typeConverter;
...
public void configure(Map<String, ?> props) {
...
typeConverter = getCamelContext().getTypeConverter();
}
```
The last SMT instance configured in a plugin classloader therefore
overwrites the converter used by
every other connector's transforms in that worker. It is behaviourally
benign only for as long as
every context's converter registry resolves identically.
**2. The SMT's `CamelContext` is never released**
`CamelTransformSupport` creates a `DefaultCamelContext` per instance:
```java
private final CamelContext camelContext = new DefaultCamelContext();
```
and `CamelTypeConverterTransform.close()` is empty. Kafka Connect
re-instantiates transforms on every
connector configuration update, so these contexts accumulate for the
lifetime of the worker. The core
tasks do the right thing here — `CamelSinkTask.stop()` /
`CamelSourceTask.stop()` stop `cms`.
**3. The full record value is embedded in the thrown exception**
```java
throw new DataException(String.format("CamelTypeConverter was not able to
convert value `%s` to target type of `%s`",
originalValue, fieldTargetType.getSimpleName()));
```
The whole record value ends up in the exception message, which Kafka Connect
surfaces in the worker
log and in the task's status through the REST API. The target type alone is
enough to diagnose the
failure.
## Expected Behavior
- The converter is an instance field, scoped to the SMT instance that
configured it.
- `close()` releases the `CamelContext` the instance created.
- The conversion failure message identifies the source and target **types**,
not the record content.
## Actual Behavior
The converter is shared process-wide, contexts leak for the worker's
lifetime, and record content is
copied into an exception message that reaches logs and the status endpoint.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]