NPE when providing pass-through props as an env variable [DBZ-5740]
- Dominant language
- HTML
- Stars
- 6
- Forks
- 9
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 1
Description
Migrated from [DBZ-5740](https://issues.redhat.com/browse/DBZ-5740)
h1. Bug report
h2. What Debezium connector do you use and what version?
Debezium Server 1.9.6.Final with MSSQL Driver
h2. What is the connector configuration?
N/A
h2. What is the captured database version and mode of depoyment?
GCP Cloud SQL instance running SQL Server 2019 Standard
h2. What behaviour do you expect?
JDBC connection string properties are correctly passed to the driver.
h2. What behaviour do you see?
Example:
{noformat}
debezium.source.database.applicationName="Test Application 123"{noformat}
When I set JDBC connection property through `application.properties` file in `/conf` folder, Debezium Server starts without any issues. I can even verify it by seeing the following log entry:
{noformat}
{
"timestamp": "2022-10-18T17:10:14.78Z",
"sequence": 142,
"loggerClassName": "org.slf4j.impl.Slf4jLogger",
"loggerName": "io.debezium.connector.common.BaseSourceTask",
"level": "INFO",
"message": " database.applicationName = \"Test Application 123\"",
"threadName": "pool-7-thread-1",
"threadId": 17,
"mdc": {},
"ndc": "",
"hostName": "",
"processName": "io.debezium.server.Main",
"processId": 84
}{noformat}
However, when I set connection property as an env variable:
1. in docker container:
{noformat}
ENV debezium.source.database.applicationName "Test Application 123"{noformat}
2. or in the k8s yaml:
{noformat}
- name: debezium.source.database.applicationName
- value: "Test Application 123"{noformat}
Debezium doesn't start because of the following exception:
{noformat}
{
"timestamp": "2022-10-18T17:30:52.393Z",
"sequence": 119,
"loggerClassName": "org.jboss.logging.Logger",
"loggerName": "io.quarkus.runtime.Application",
"level": "ERROR",
"message": "Failed to start application (with profile prod)",
"threadName": "main",
"threadId": 1,
"mdc": {},
"ndc": "",
"hostName": "",
"processName": "io.debezium.server.Main",
"processId": 84,
"exception": {
"refId": 1,
"exceptionType": "java.lang.NullPointerException",
"message": null,
"frames": [
{
"class": "java.util.concurrent.ConcurrentHashMap",
"method": "putVal",
"line": 1011
},
{
"class": "java.util.concurrent.ConcurrentHashMap",
"method": "put",
"line": 1006
},
{
"class": "java.util.Properties",
"method": "put",
"line": 1340
},
{
"class": "java.util.Properties",
"method": "setProperty",
"line": 228
},
{
"class": "io.debezium.server.DebeziumServer",
"method": "configToProperties",
"line": 176
},
{
"class": "io.debezium.server.DebeziumServer",
"method": "start",
"line": 125
},
{
"class": "io.debezium.server.DebeziumServer_Bean",
"method": "create"
},
{
"class": "io.debezium.server.DebeziumServer_Bean",
"method": "create"
},
{
"class": "io.quarkus.arc.impl.AbstractSharedContext",
"method": "createInstanceHandle",
"line": 101
},
{
"class": "io.quarkus.arc.impl.AbstractSharedContext$1",
"method": "get",
"line": 29
},
{
"class": "io.quarkus.arc.impl.AbstractSharedContext$1",
"method": "get",
"line": 26
},
{
"class": "io.quarkus.arc.impl.LazyValue",
"method": "get",
"line": 26
},
{
"class": "io.quarkus.arc.impl.ComputingCache",
"method": "computeIfAbsent",
"line": 69
},
{
"class": "io.quarkus.arc.impl.AbstractSharedContext",
"method": "get",
"line": 26
},
{
"class": "io.quarkus.arc.impl.ClientProxies",
"method": "getApplicationScopedDelegate",
"line": 18
},
{
"class": "io.debezium.server.DebeziumServer_ClientProxy",
"method": "arc$delegate"
},
{
"class": "io.debezium.server.DebeziumServer_ClientProxy",
"method": "arc_contextualInstance"
},
{
"class": "io.debezium.server.DebeziumServer_Observer_Synthetic_d70cd75bf32ab6598217b9a64a8473d65e248c05",
"method": "notify"
},
{
"class": "io.quarkus.arc.impl.EventImpl$Notifier",
"method": "notifyObservers",
"line": 320
},
{
"class": "io.quarkus.arc.impl.EventImpl$Notifier",
"method": "notify",
"line": 302
},
{
"class": "io.quarkus.arc.impl.EventImpl",
"method": "fire",
"line": 73
},
{
"class": "io.quarkus.arc.runtime.ArcRecorder",
"method": "fireLifecycleEvent",
"line": 128
},
{
"class": "io.quarkus.arc.runtime.ArcRecorder",
"method": "handleLifecycleEvents",
"line": 97
},
{
"class": "io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294",
"method": "deploy_0"
},
{
"class": "io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294",
"method": "deploy"
},
{
"class": "io.quarkus.runner.ApplicationImpl",
"method": "doStart"
},
{
"class": "io.quarkus.runtime.Application",
"method": "start",
"line": 101
},
{
"class": "io.quarkus.runtime.ApplicationLifecycleManager",
"method": "run",
"line": 103
},
{
"class": "io.quarkus.runtime.Quarkus",
"method": "run",
"line": 67
},
{
"class": "io.quarkus.runtime.Quarkus",
"method": "run",
"line": 41
},
{
"class": "io.quarkus.runtime.Quarkus",
"method": "run",
"line": 120
},
{
"class": "io.debezium.server.Main",
"method": "main",
"line": 15
}
]
}
}
{noformat}
h2. Do you see the same behaviour using the latest relesead Debezium version?
The behaviour was verified on Debezium 1.9.6.Final.
h2. Do you have the connector logs, ideally from start till finish?
Stack trace was provided above.
h2. How to reproduce the issue using our [tutorial|https://github.com/debezium/debezium-examples/tree/main/tutorial] deployment?
N/A
Contributor guide
Research direction
Start in DebeziumServer.configToProperties at line 176, called from start at line 125, and compare the environment-variable path with the application.properties path described in the report. Reproduce the pass-through property using the shown Docker or Kubernetes environment setting; done means startup no longer throws a NullPointerException and the JDBC property reaches the driver.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100