Open oscarjohansson94 opened 2 years ago
Hi,
Does this issue prevents cp-kafka-connect
to start properly ?
The container stuck in health check:
d495df064e84 confluentinc/cp-kafka-connect:7.0.1 "/etc/confluent/dock…" 9 minutes ago Up 9 minutes (health: starting)
Then it restarts every 10 minutes.
@stondini If org.slf4j.impl.Log4jLoggerFactory
gets chosen then cp-kafka-connect
will not start properly. But I think you need to provide more information before we can determine if you experience the same issue as me. Could you please post the logging you get when this happens?
@oscarjohansson94 I get the same logs as you.
I downgraded Connect to confluentinc/cp-kafka-connect:6.1.4
which works well.
@stondini If you want to use 7.0.1 you can add this to your docker file to remove one of the loggers.
FROM confluentinc/cp-kafka-connect:7.0.1
RUN rm /usr/share/java/cp-base-new/slf4j-log4j12-*.jar
I'm using Docker Compose, so I modified compose file in order to execute the rm
command:
command:
- bash
- -c
- |
rm /usr/share/java/cp-base-new/slf4j-log4j12-*.jar
echo "Launching Kafka Connect"
/etc/confluent/docker/run &
sleep infinity
Content of the folderr /usr/share/java/cp-base-new
without rm
command:
-rw-r--r-- 1 appuser appuser 41472 Jan 11 22:01 slf4j-api-1.7.30.jar
-rw-r--r-- 1 appuser appuser 12211 Jan 11 22:06 slf4j-log4j12-1.7.30.jar
-rw-r--r-- 1 appuser appuser 15239 Jan 11 22:06 slf4j-simple-1.7.30.jar
Content of the folderr /usr/share/java/cp-base-new
with rm
command:
-rw-r--r-- 1 appuser appuser 41472 Jan 11 22:01 slf4j-api-1.7.30.jar
-rw-r--r-- 1 appuser appuser 15239 Jan 11 22:06 slf4j-simple-1.7.30.jar
But nothing changed. Connect restarts every 10min.
@stondini You are removing the file using docker command, which is executed in run time. There might be a case where:
I suggested that you copy my example dockerfile and then build it using docker compose and remove your command.
Besides the fact that several implementations of SLF4J in classpath do not give confidence as to the quality of this version, these are only warnings...
As a workaround, you can use this in your kuberenetes deployment:
volumeMounts:
- name: slf4j-exclude
mountPath: /exclude
readOnly: true
volumes:
- name: slf4j-exclude
emptyDir: {}
Moving to version 7.0.14 also solved the issue
Hi!
This refers to
cp-kafka-connect:7.0.1
.When running cp-kafka-connect docker image we stumble upon inconsistent behavior of SLF4J. The default
CUB_CLASSPATH
is set to/usr/share/java/cp-base-new/
where multiple loggers exists:slf4j-simple-1.7.30.jar
slf4j-log4j12-1.7.30.jar
On one machine we consistently get the error:
So it finds multiple loggers (which are included in the image cp-kafka-connect), chooses Log4jLoggerFactory and proceeds to crash. The documentation provided (http://www.slf4j.org/codes.html#multiple_bindings) states that there should only be one logger defined in the class path.
However, on another machine we consistently get the output:
In this case it happens to choose SimpleLoggerFactory instead of Log4jLoggerFactory, and proceeds happily.
Workaround Delete
/usr/share/java/cp-base-new/slf4j-log4j12-1.7.30.jar
It seems like
/usr/share/java/cp-base-new/slf4j-log4j12-1.7.30.jar
should not exist in the classpath