[
https://issues.apache.org/jira/browse/KAFKA-20693?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18101117#comment-18101117
]
Yunseop Eom commented on KAFKA-20693:
-------------------------------------
Opened PR #23030: https://github.com/apache/kafka/pull/23030
The PR fixes the NPE in AbstractHerder.maybeAddConfigErrors when a generated
ConfigInfo has no ConfigValueInfo. The null entry is skipped while errors from
populated config values remain in the REST response.
TDD verification reproduced the baseline NPE in 3 of 6 focused tests, then all
6 passed after the null guard. Checkstyle, SpotBugs, and git diff --check pass.
The full runtime suite encountered two unrelated synchronization timing
timeouts; both passed on isolated rerun. The PR is open and awaiting review.
> NPE in error handling in AbstractHerder
> ---------------------------------------
>
> Key: KAFKA-20693
> URL: https://issues.apache.org/jira/browse/KAFKA-20693
> Project: Kafka
> Issue Type: Bug
> Components: connect
> Affects Versions: 4.2.1
> Reporter: Gaetan Collaud
> Priority: Major
> Attachments: image-2026-06-15-17-19-03-817.png
>
>
> When creating a connector using _PUT /connectors/abc/config_ and providing
> wrong credentials for example for the Oracle database (when using
> debezium-oracle) the REST endpoint returns something like this:
>
> {code:java}
> {
> "error_code":500,
> "message":"Cannot invoke
> \"org.apache.kafka.connect.runtime.rest.entities.ConfigValueInfo.errors()\"
> because the return value of
> \"org.apache.kafka.connect.runtime.rest.entities.ConfigInfo.configValue()\"
> is null"
> } {code}
> In the log, the full stack trace looks like this:
> {code:java}
> 2026-06-15T16:05:28,860 ERROR || Uncaught exception in REST call to
> /connectors/abc/config
> [org.apache.kafka.connect.runtime.rest.errors.ConnectExceptionMapper]
> java.lang.NullPointerException: Cannot invoke
> "org.apache.kafka.connect.runtime.rest.entities.ConfigValueInfo.errors()"
> because the return value of
> "org.apache.kafka.connect.runtime.rest.entities.ConfigInfo.configValue()" is
> null
> at
> org.apache.kafka.connect.runtime.AbstractHerder.maybeAddConfigErrors(AbstractHerder.java:1077)
> at
> org.apache.kafka.connect.runtime.distributed.DistributedHerder.lambda$doPutConnectorConfig$1(DistributedHerder.java:1144)
> at
> org.apache.kafka.connect.runtime.distributed.DistributedHerder.runRequest(DistributedHerder.java:2382)
> at
> org.apache.kafka.connect.runtime.distributed.DistributedHerder.tick(DistributedHerder.java:499)
> at
> org.apache.kafka.connect.runtime.distributed.DistributedHerder.run(DistributedHerder.java:384)
> at
> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
> at java.base/java.lang.Thread.run(Thread.java:1583)
> {code}
> The actual error message (wrong credentials) can be found earlier in the log,
> but the REST response is misleading and hides the root cause.
> Source code causing issue:
> [https://github.com/apache/kafka/blob/trunk/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/AbstractHerder.java#L1077]
> Apparently the configValue can be null.
> Looking at github, apparently some clean-up was done in this area, maybe it's
> related, maybe not: [https://github.com/apache/kafka/pull/20393]
> h1. Additional observations
> h2. Observation 1
> The debezium field that causes trouble is "database.out.server.name". This
> field is only a deprecated alias as shown here:
> [https://github.com/debezium/debezium/blob/main/debezium-connector-oracle/src/main/java/io/debezium/connector/oracle/OracleConnectorConfig.java#L88-L98]
> This is the only deprecated alias from the OracleConnectorConfig
> !image-2026-06-15-17-19-03-817.png!
> h2. Observation 2
> AbstractHerder allows null value:
> [https://github.com/apache/kafka/blob/trunk/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/AbstractHerder.java#L981-L987]
> h2. Observation 3
> Debezium defines additional ConfigDef for deprecated properties but only
> validate genuine one. This causes a difference in the loop when printing the
> error in AbstractHerder.
> [https://github.com/debezium/debezium/blob/main/debezium-config/src/main/java/io/debezium/config/Field.java#L481-L495]
> h1. How to reproduce:
> Try to create an OracleConnector with an oracle that is not reachable or with
> wrong credentials.
> _config-connector.json_
> {code:java}
> {
> "connector.class": "io.debezium.connector.oracle.OracleConnector",
> "tasks.max": "1",
> "database.hostname": "do.not.exists",
> "database.port": "3333",
> "database.user": "dbz",
> "database.password": "secret3",
> "database.dbname": "abc",
> "schema.include.list": "a",
> "table.include.list": "b.c"
> } {code}
> {code:java}
> curl -X PUT -H "Content-type: application/json" -d @config-connector.json
> localhost:8083/connectors/abc/config {code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)