You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Joker-5 (via GitHub)" <gi...@apache.org> on 2024/04/02 07:21:12 UTC
[PR] KAFKA-16068: Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors [kafka]
Joker-5 opened a new pull request, #15642:
URL: https://github.com/apache/kafka/pull/15642
Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors
### Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16068: Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors [kafka]
Posted by "Joker-5 (via GitHub)" <gi...@apache.org>.
Joker-5 commented on code in PR #15642:
URL: https://github.com/apache/kafka/pull/15642#discussion_r1552049826
##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/ConnectorValidationIntegrationTest.java:
##########
@@ -69,6 +69,9 @@ public static void setup() {
Map<String, String> workerProps = new HashMap<>();
workerProps.put(GROUP_ID_CONFIG, WORKER_GROUP_ID);
+ // Work around a circular-dependency in TestPlugins.
+ TestPlugins.pluginPath();
Review Comment:
> Thanks for the explanation. hmm I ran the tests in `ConnectorValidationIntergationTest` without this one line but including all others and the tests are passing for me locally. I created a branch (draft, we can close it once we have validated the behaviour) #15653 with the changes. We can monitor if the circular dependency related errors show up there or not.
@vamossagar12, I checked the result from #15653 which did not have related errors, so I removed this one line.
Maybe there's some problem in my local env, I will try to investigate the root cause :)
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16068: Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors [kafka]
Posted by "Joker-5 (via GitHub)" <gi...@apache.org>.
Joker-5 commented on code in PR #15642:
URL: https://github.com/apache/kafka/pull/15642#discussion_r1547609546
##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/ConnectorValidationIntegrationTest.java:
##########
@@ -331,7 +334,7 @@ public void testConnectorHasAbstractConverter() throws InterruptedException {
@Test
public void testConnectorHasConverterWithNoSuitableConstructor() throws InterruptedException {
Map<String, String> config = defaultSinkConnectorProps();
- config.put(KEY_CONVERTER_CLASS_CONFIG, TestConverterWithPrivateConstructor.class.getName());
+ config.put(KEY_CONVERTER_CLASS_CONFIG, TestPlugins.TestPlugin.ALWAYS_THROW_EXCEPTION.className());
Review Comment:
oops, I misread the code, now I've corrected it.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16068: Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors [kafka]
Posted by "gharris1727 (via GitHub)" <gi...@apache.org>.
gharris1727 closed pull request #15642: KAFKA-16068: Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors
URL: https://github.com/apache/kafka/pull/15642
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16068: Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors [kafka]
Posted by "Joker-5 (via GitHub)" <gi...@apache.org>.
Joker-5 commented on code in PR #15642:
URL: https://github.com/apache/kafka/pull/15642#discussion_r1552049826
##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/ConnectorValidationIntegrationTest.java:
##########
@@ -69,6 +69,9 @@ public static void setup() {
Map<String, String> workerProps = new HashMap<>();
workerProps.put(GROUP_ID_CONFIG, WORKER_GROUP_ID);
+ // Work around a circular-dependency in TestPlugins.
+ TestPlugins.pluginPath();
Review Comment:
> Thanks for the explanation. hmm I ran the tests in `ConnectorValidationIntergationTest` without this one line but including all others and the tests are passing for me locally. I created a branch (draft, we can close it once we have validated the behaviour) #15653 with the changes. We can monitor if the circular dependency related errors show up there or not.
@vamossagar12, I checked the result from #15653 which did not have related errors, so I removed this one line.
Maybe there's some problems in my local env, I will try to investigate the root cause :)
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16068: Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors [kafka]
Posted by "vamossagar12 (via GitHub)" <gi...@apache.org>.
vamossagar12 commented on code in PR #15642:
URL: https://github.com/apache/kafka/pull/15642#discussion_r1547506743
##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/ConnectorValidationIntegrationTest.java:
##########
@@ -343,7 +346,7 @@ public void testConnectorHasConverterWithNoSuitableConstructor() throws Interrup
@Test
public void testConnectorHasConverterThatThrowsExceptionOnInstantiation() throws InterruptedException {
Map<String, String> config = defaultSinkConnectorProps();
- config.put(KEY_CONVERTER_CLASS_CONFIG, TestConverterWithConstructorThatThrowsException.class.getName());
+ config.put(KEY_CONVERTER_CLASS_CONFIG, TestPlugins.TestPlugin.ALWAYS_THROW_EXCEPTION.className());
Review Comment:
We could probably use `BAD_PACKAGING_DEFAULT_CONSTRUCTOR_THROWS_CONNECTOR` and in `testConnectorHasHeaderConverterThatThrowsExceptionOnInstantiation` as well?
##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/ConnectorValidationIntegrationTest.java:
##########
@@ -69,6 +69,9 @@ public static void setup() {
Map<String, String> workerProps = new HashMap<>();
workerProps.put(GROUP_ID_CONFIG, WORKER_GROUP_ID);
+ // Work around a circular-dependency in TestPlugins.
+ TestPlugins.pluginPath();
Review Comment:
Why do we need this?
##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/ConnectorValidationIntegrationTest.java:
##########
@@ -331,7 +334,7 @@ public void testConnectorHasAbstractConverter() throws InterruptedException {
@Test
public void testConnectorHasConverterWithNoSuitableConstructor() throws InterruptedException {
Map<String, String> config = defaultSinkConnectorProps();
- config.put(KEY_CONVERTER_CLASS_CONFIG, TestConverterWithPrivateConstructor.class.getName());
+ config.put(KEY_CONVERTER_CLASS_CONFIG, TestPlugins.TestPlugin.ALWAYS_THROW_EXCEPTION.className());
Review Comment:
I think we should use `BAD_PACKAGING_DEFAULT_CONSTRUCTOR_PRIVATE_CONNECTOR` in this case as well?
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16068: Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors [kafka]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #15642:
URL: https://github.com/apache/kafka/pull/15642#issuecomment-2297941350
This PR is being marked as stale since it has not had any activity in 90 days. If you would like to keep this PR alive, please ask a committer for review. If the PR has merge conflicts, please update it with the latest from trunk (or appropriate release branch) <p> If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 30 days, it will be automatically closed.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16068: Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors [kafka]
Posted by "Joker-5 (via GitHub)" <gi...@apache.org>.
Joker-5 commented on code in PR #15642:
URL: https://github.com/apache/kafka/pull/15642#discussion_r1547690392
##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/ConnectorValidationIntegrationTest.java:
##########
@@ -69,6 +69,9 @@ public static void setup() {
Map<String, String> workerProps = new HashMap<>();
workerProps.put(GROUP_ID_CONFIG, WORKER_GROUP_ID);
+ // Work around a circular-dependency in TestPlugins.
+ TestPlugins.pluginPath();
Review Comment:
If we don't add this, methods which use `TestPlugins` will have erroneous behavior. In particular:
```
[2024-04-02 19:16:25,977] ERROR Could not set up plugin test jars (org.apache.kafka.connect.runtime.isolation.TestPlugins:258)
java.lang.NullPointerException
at org.apache.kafka.connect.runtime.isolation.TestPlugins$TestPlugin.values(TestPlugins.java:69)
at org.apache.kafka.connect.runtime.isolation.TestPlugins.<clinit>(TestPlugins.java:251)
at org.apache.kafka.connect.runtime.isolation.TestPlugins$TestPlugin.<clinit>(TestPlugins.java:128)
at org.apache.kafka.connect.integration.ConnectorValidationIntegrationTest.testConnectorHasConverterWithNoSuitableConstructor(ConnectorValidationIntegrationTest.java:337)
...
```
I have found the reason behind it:
>TL;DR
The whole error occurred because the circle: inner class(some field depend on outer class in the \<clinit> method) -> outer class(some line in static code block depend on inner class in the \<clinit> method) -> inner class
1. There's a `private final Predicate<String> removeRuntimeClasses` field in the inner class `org.apache.kafka.connect.runtime.isolation.TestPlugins.TestPlugin`.
2. Some enums such as `BAD_PACKAGING_MISSING_SUPERCLASS` in (1)'s field will depend on `private static final Predicate<String> REMOVE_CLASS_FILTER = s -> s.contains("NonExistentInterface")` in the outer class(`org.apache.kafka.connect.runtime.isolation.TestPlugins`).
3. When test mothod such as `testConnectorHasConverterWithNoSuitableConstructor` is running, JVM will call \<clinit> method to initialize the inner class(`org.apache.kafka.connect.runtime.isolation.TestPlugins.TestPlugin`).
4. But some enum use the field(`removeRuntimeClasses`) in the outer class(`private static final Predicate<String> REMOVE_CLASS_FILTER = s -> s.contains("NonExistentInterface")`), so at that time JVM has to call \<clinit> method to initialize the outer class(`org.apache.kafka.connect.runtime.isolation.TestPlugins`).
5. In the outer class, there's a static code block which used the inner class. But the inner class have not been initialized, the circular-dependency just happened, which result in that error log.
```java
static {
Throwable err = null;
Map<String, Path> pluginJars = new HashMap<>();
try {
for (TestPlugin testPlugin : TestPlugin.values()) { // see this line
if (pluginJars.containsKey(testPlugin.resourceDir())) {
log.debug("Skipping recompilation of " + testPlugin.resourceDir());
}
pluginJars.put(testPlugin.resourceDir(), createPluginJar(testPlugin.resourceDir(), testPlugin.removeRuntimeClasses()));
}
} catch (Throwable e) {
log.error("Could not set up plugin test jars", e);
err = e;
}
PLUGIN_JARS = Collections.unmodifiableMap(pluginJars);
INITIALIZATION_EXCEPTION = err;
}
```
So that's why I added the code.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16068: Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors [kafka]
Posted by "Joker-5 (via GitHub)" <gi...@apache.org>.
Joker-5 commented on code in PR #15642:
URL: https://github.com/apache/kafka/pull/15642#discussion_r1547632847
##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/ConnectorValidationIntegrationTest.java:
##########
@@ -343,7 +346,7 @@ public void testConnectorHasConverterWithNoSuitableConstructor() throws Interrup
@Test
public void testConnectorHasConverterThatThrowsExceptionOnInstantiation() throws InterruptedException {
Map<String, String> config = defaultSinkConnectorProps();
- config.put(KEY_CONVERTER_CLASS_CONFIG, TestConverterWithConstructorThatThrowsException.class.getName());
+ config.put(KEY_CONVERTER_CLASS_CONFIG, TestPlugins.TestPlugin.ALWAYS_THROW_EXCEPTION.className());
Review Comment:
At the beginning I used `BAD_PACKAGING_DEFAULT_CONSTRUCTOR_THROWS_CONNECTOR` in the case, but I thought `ALWAYS_THROW_EXCEPTION` has stronger sematics, that's why I changed my mind.
But now I think about the case again, I think `BAD_PACKAGING_DEFAULT_CONSTRUCTOR_THROWS_CONNECTOR ` has fine-grain sematics which is more suitable for the case.
So I will change it. Thanks so much for pointing out that.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16068: Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors [kafka]
Posted by "Joker-5 (via GitHub)" <gi...@apache.org>.
Joker-5 commented on code in PR #15642:
URL: https://github.com/apache/kafka/pull/15642#discussion_r1547690392
##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/ConnectorValidationIntegrationTest.java:
##########
@@ -69,6 +69,9 @@ public static void setup() {
Map<String, String> workerProps = new HashMap<>();
workerProps.put(GROUP_ID_CONFIG, WORKER_GROUP_ID);
+ // Work around a circular-dependency in TestPlugins.
+ TestPlugins.pluginPath();
Review Comment:
If we don't add this, methods which use `TestPlugins` will have erroneous behavior. In particular:
```
[2024-04-02 19:16:25,977] ERROR Could not set up plugin test jars (org.apache.kafka.connect.runtime.isolation.TestPlugins:258)
java.lang.NullPointerException
at org.apache.kafka.connect.runtime.isolation.TestPlugins$TestPlugin.values(TestPlugins.java:69)
at org.apache.kafka.connect.runtime.isolation.TestPlugins.<clinit>(TestPlugins.java:251)
at org.apache.kafka.connect.runtime.isolation.TestPlugins$TestPlugin.<clinit>(TestPlugins.java:128)
at org.apache.kafka.connect.integration.ConnectorValidationIntegrationTest.testConnectorHasConverterWithNoSuitableConstructor(ConnectorValidationIntegrationTest.java:337)
...
```
I found the reason behind it:
>TL;DR
The whole error occurred because the circle: inner class(some field depend on outer class in the \<clinit> method) -> outer class(some line in static code block depend on inner class in the \<clinit> method) -> inner class
1. There's a `private final Predicate<String> removeRuntimeClasses` field in the inner class `org.apache.kafka.connect.runtime.isolation.TestPlugins.TestPlugin`.
2. Some enums such as `BAD_PACKAGING_MISSING_SUPERCLASS` in (1)'s field will depend on `private static final Predicate<String> REMOVE_CLASS_FILTER = s -> s.contains("NonExistentInterface")` in the outer class(`org.apache.kafka.connect.runtime.isolation.TestPlugins`).
3. When test mothod such as `testConnectorHasConverterWithNoSuitableConstructor` is running, JVM will call \<clinit> method to initialize the inner class(`org.apache.kafka.connect.runtime.isolation.TestPlugins.TestPlugin`).
4. But some enum use the field(`removeRuntimeClasses`) in the outer class(`private static final Predicate<String> REMOVE_CLASS_FILTER = s -> s.contains("NonExistentInterface")`), so at that time JVM has to call \<clinit> method to initialize the outer class(`org.apache.kafka.connect.runtime.isolation.TestPlugins`).
5. In the outer class, there's a static code block which used the inner class. But the inner class have not been initialized, the circular-dependency just happened, which result in that error log.
```java
static {
Throwable err = null;
Map<String, Path> pluginJars = new HashMap<>();
try {
for (TestPlugin testPlugin : TestPlugin.values()) { // see this line
if (pluginJars.containsKey(testPlugin.resourceDir())) {
log.debug("Skipping recompilation of " + testPlugin.resourceDir());
}
pluginJars.put(testPlugin.resourceDir(), createPluginJar(testPlugin.resourceDir(), testPlugin.removeRuntimeClasses()));
}
} catch (Throwable e) {
log.error("Could not set up plugin test jars", e);
err = e;
}
PLUGIN_JARS = Collections.unmodifiableMap(pluginJars);
INITIALIZATION_EXCEPTION = err;
}
```
So that's why I added the code.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16068: Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors [kafka]
Posted by "Joker-5 (via GitHub)" <gi...@apache.org>.
Joker-5 commented on code in PR #15642:
URL: https://github.com/apache/kafka/pull/15642#discussion_r1547632847
##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/ConnectorValidationIntegrationTest.java:
##########
@@ -343,7 +346,7 @@ public void testConnectorHasConverterWithNoSuitableConstructor() throws Interrup
@Test
public void testConnectorHasConverterThatThrowsExceptionOnInstantiation() throws InterruptedException {
Map<String, String> config = defaultSinkConnectorProps();
- config.put(KEY_CONVERTER_CLASS_CONFIG, TestConverterWithConstructorThatThrowsException.class.getName());
+ config.put(KEY_CONVERTER_CLASS_CONFIG, TestPlugins.TestPlugin.ALWAYS_THROW_EXCEPTION.className());
Review Comment:
At the beginning I used `BAD_PACKAGING_DEFAULT_CONSTRUCTOR_THROWS_CONNECTOR` in the case, but I thought `ALWAYS_THROW_EXCEPTION` has stronger sematics, that's why I changed my mind.
But now I think about the case again, I think `BAD_PACKAGING_DEFAULT_CONSTRUCTOR_THROWS_CONNECTOR ` has fine-grain sematics which is more suitable for the case.
I've changed it. Thanks so much for pointing out that.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16068: Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors [kafka]
Posted by "gharris1727 (via GitHub)" <gi...@apache.org>.
gharris1727 commented on code in PR #15642:
URL: https://github.com/apache/kafka/pull/15642#discussion_r1554188423
##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/ConnectorValidationIntegrationTest.java:
##########
@@ -69,6 +69,9 @@ public static void setup() {
Map<String, String> workerProps = new HashMap<>();
workerProps.put(GROUP_ID_CONFIG, WORKER_GROUP_ID);
+ // Work around a circular-dependency in TestPlugins.
+ TestPlugins.pluginPath();
Review Comment:
The circular dependency is still a problem that I haven't resolved, sorry. It's fixed in this un-merged PR: #13333
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16068: Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors [kafka]
Posted by "Joker-5 (via GitHub)" <gi...@apache.org>.
Joker-5 commented on code in PR #15642:
URL: https://github.com/apache/kafka/pull/15642#discussion_r1547690392
##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/ConnectorValidationIntegrationTest.java:
##########
@@ -69,6 +69,9 @@ public static void setup() {
Map<String, String> workerProps = new HashMap<>();
workerProps.put(GROUP_ID_CONFIG, WORKER_GROUP_ID);
+ // Work around a circular-dependency in TestPlugins.
+ TestPlugins.pluginPath();
Review Comment:
@vamossagar12 If we don't add this, methods which use `TestPlugins` will have erroneous behavior. In particular:
```
[2024-04-02 19:16:25,977] ERROR Could not set up plugin test jars (org.apache.kafka.connect.runtime.isolation.TestPlugins:258)
java.lang.NullPointerException
at org.apache.kafka.connect.runtime.isolation.TestPlugins$TestPlugin.values(TestPlugins.java:69)
at org.apache.kafka.connect.runtime.isolation.TestPlugins.<clinit>(TestPlugins.java:251)
at org.apache.kafka.connect.runtime.isolation.TestPlugins$TestPlugin.<clinit>(TestPlugins.java:128)
at org.apache.kafka.connect.integration.ConnectorValidationIntegrationTest.testConnectorHasConverterWithNoSuitableConstructor(ConnectorValidationIntegrationTest.java:337)
...
```
I found the reason behind it:
>TL;DR
The whole error occurred because the circle: inner class(some field depend on outer class in the \<clinit> method) -> outer class(some line in static code block depend on inner class in the \<clinit> method) -> inner class
1. There's a `private final Predicate<String> removeRuntimeClasses` field in the inner class `org.apache.kafka.connect.runtime.isolation.TestPlugins.TestPlugin`.
2. Some enums such as `BAD_PACKAGING_MISSING_SUPERCLASS` in (1)'s field will depend on `private static final Predicate<String> REMOVE_CLASS_FILTER = s -> s.contains("NonExistentInterface")` in the outer class(`org.apache.kafka.connect.runtime.isolation.TestPlugins`).
3. When test mothod such as `testConnectorHasConverterWithNoSuitableConstructor` is running, JVM will call \<clinit> method to initialize the inner class(`org.apache.kafka.connect.runtime.isolation.TestPlugins.TestPlugin`).
4. But some enum use the field(`removeRuntimeClasses`) in the outer class(`private static final Predicate<String> REMOVE_CLASS_FILTER = s -> s.contains("NonExistentInterface")`), so at that time JVM has to call \<clinit> method to initialize the outer class(`org.apache.kafka.connect.runtime.isolation.TestPlugins`).
5. In the outer class, there's a static code block which used the inner class. But the inner class have not been initialized, the circular-dependency just happened, which result in that error log.
```java
static {
Throwable err = null;
Map<String, Path> pluginJars = new HashMap<>();
try {
for (TestPlugin testPlugin : TestPlugin.values()) { // see this line
if (pluginJars.containsKey(testPlugin.resourceDir())) {
log.debug("Skipping recompilation of " + testPlugin.resourceDir());
}
pluginJars.put(testPlugin.resourceDir(), createPluginJar(testPlugin.resourceDir(), testPlugin.removeRuntimeClasses()));
}
} catch (Throwable e) {
log.error("Could not set up plugin test jars", e);
err = e;
}
PLUGIN_JARS = Collections.unmodifiableMap(pluginJars);
INITIALIZATION_EXCEPTION = err;
}
```
So that's why I added the code.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16068: Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors [kafka]
Posted by "vamossagar12 (via GitHub)" <gi...@apache.org>.
vamossagar12 commented on code in PR #15642:
URL: https://github.com/apache/kafka/pull/15642#discussion_r1551420344
##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/ConnectorValidationIntegrationTest.java:
##########
@@ -69,6 +69,9 @@ public static void setup() {
Map<String, String> workerProps = new HashMap<>();
workerProps.put(GROUP_ID_CONFIG, WORKER_GROUP_ID);
+ // Work around a circular-dependency in TestPlugins.
+ TestPlugins.pluginPath();
Review Comment:
Thanks for the explanation. hmm I ran the tests in `ConnectorValidationIntergationTest` without this one line but including all others and the tests are passing for me locally. I created a branch (draft, we can close it once we have validated the behaviour) https://github.com/apache/kafka/pull/15653 with the changes. We can monitor if the circular dependency related errors show up there or not.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16068: Use TestPlugins in ConnectorValidationIntegrationTest to silence plugin scanning errors [kafka]
Posted by "gharris1727 (via GitHub)" <gi...@apache.org>.
gharris1727 commented on PR #15642:
URL: https://github.com/apache/kafka/pull/15642#issuecomment-2299398801
This has been superseded by #16647 and so is no longer necessary.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org