kloadgen icon indicating copy to clipboard operation
kloadgen copied to clipboard

Failing to connect to Kafka

Open ShantiSumanth opened this issue 2 years ago • 43 comments

Hi, Trying to make a connection to Kafka and produce message(son) to a topic but failing to connect.

Whilst sending a message using JMeter below issues are seen Kafka producer is closing with timeout=0ms Login module control flag not specified in JAAS config.

Please find the login specified in jaas.conf Screen Shot 2022-05-04 at 12 55 43

Have tried all the possible ways in defining the credentials in config file but didn't worked, would appreciate your help in sorting the issue?

Thanks

KloadGen Version

Kloadgen-3.5.3

Relevant log output

INFO o.a.k.c.p.KafkaProducer: [Producer clientId=perf-test] Closing the Kafka producer with timeoutMillis = 0 ms.
2022-04-28 11:04:20,547 INFO o.a.k.c.m.Metrics: Metrics scheduler closed
2022-04-28 11:04:20,547 INFO o.a.k.c.m.Metrics: Closing reporter org.apache.kafka.common.metrics.JmxReporter
2022-04-28 11:04:20,547 INFO o.a.k.c.m.Metrics: Metrics reporters closed
2022-04-28 11:04:20,547 INFO o.a.k.c.u.AppInfoParser: App info kafka.producer for perf-test unregistered
2022-04-28 11:04:20,548 ERROR o.a.j.p.j.s.AbstractJavaSamplerClient: Failed to construct kafka producer
org.apache.kafka.common.KafkaException: Failed to construct kafka producer
	at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:440) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
	at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:291) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
	at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:318) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
	at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:303) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
	at net.coru.kloadgen.sampler.KafkaSchemaSampler.setupTest(KafkaSchemaSampler.java:113) [kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
	at org.apache.jmeter.protocol.java.sampler.JavaSampler.sample(JavaSampler.java:194) [ApacheJMeter_java.jar:5.4.1]
	at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638) [ApacheJMeter_core.jar:5.4.1]
	at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558) [ApacheJMeter_core.jar:5.4.1]
	at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) [ApacheJMeter_core.jar:5.4.1]
	at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) [ApacheJMeter_core.jar:5.4.1]
	at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.IllegalArgumentException: Login module control flag not specified in JAAS config
	at org.apache.kafka.common.security.JaasConfig.parseAppConfigurationEntry(JaasConfig.java:110) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
	at org.apache.kafka.common.security.JaasConfig.<init>(JaasConfig.java:63) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
	at org.apache.kafka.common.security.JaasContext.load(JaasContext.java:88) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
	at org.apache.kafka.common.security.JaasContext.loadClientContext(JaasContext.java:82) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
	at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:167) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
	at org.apache.kafka.common.network.ChannelBuilders.clientChannelBuilder(ChannelBuilders.java:81) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
	at org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:105) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
	at org.apache.kafka.clients.producer.KafkaProducer.newSender(KafkaProducer.java:448) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
	at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:429) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
	... 10 more
2022-04-28 11:04:20,552 ERROR o.a.j.p.j.s.AbstractJavaSamplerClient: Failed to send message
java.lang.NullPointerException: Cannot invoke "org.apache.kafka.clients.producer.KafkaProducer.send(org.apache.kafka.clients.producer.ProducerRecord, org.apache.kafka.clients.producer.Callback)" because "this.producer" is null
	at net.coru.kloadgen.sampler.KafkaSchemaSampler.runTest(KafkaSchemaSampler.java:153) [kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
	at org.apache.jmeter.protocol.java.sampler.JavaSampler.sample(JavaSampler.java:197) [ApacheJMeter_java.jar:5.4.1]
	at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638) [ApacheJMeter_core.jar:5.4.1]
	at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558) [ApacheJMeter_core.jar:5.4.1]
	at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) [ApacheJMeter_core.jar:5.4.1]
	at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) [ApacheJMeter_core.jar:5.4.1]
	at java.lang.Thread.run(Thread.java:833) [?:?]
2022-04-28 11:04:20,553 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group - KLoadgen 1-1
2022-04-28 11:04:20,553 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group - KLoadgen 1-1
2022-04-28 11:04:20,553 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test
2022-04-28 11:04:20,554 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, *local*)

Have you added your JMX Testplan or a replica?

  • [X] I have added a JMX testplan

Have you added your Schema or a replica?

  • [X] I have added the Schema
Screen Shot 2022-05-04 at 13 17 38 Screen Shot 2022-05-04 at 13 18 04 Screen Shot 2022-05-04 at 13 18 26

ShantiSumanth avatar May 04 '22 12:05 ShantiSumanth

Thank you for collaborating with the project by giving us feedback!!' You will help us a lot if you can attach an example AVRO and an example Test Plan in order to be able to reproduce the error, if that is the case. Cheers

github-actions[bot] avatar May 04 '22 12:05 github-actions[bot]

Hi @ShantiSumanth

Thank you for your collaboration, we will review it and the changes/progress that we are making will inform you here.

cmunozgomez avatar May 05 '22 05:05 cmunozgomez

Thanks @cmunozgomez.

ShantiSumanth avatar May 05 '22 08:05 ShantiSumanth

Hi @ShantiSumanth

We are currently reviewing the issue. We'll inform you as soon as we get a solution.

jgbriz avatar May 10 '22 06:05 jgbriz

Hi @ShantiSumanth We have problems reading the config from a jaas.conf file, try to set the kafka client auth from the jaas.conf file in the java.security.auth.login.config property of the java request. It must be a single line string like this:

KafkaClient { org.apache.kafka.common.security.plain.PlainLoginModule required username=(xxxx) password=(+dljlsjfl); };

pedror19 avatar May 10 '22 09:05 pedror19

Hi @pedror19,

I've already included Kafka client auth in java request and added auth in a single line string but didn't work. Screen Shot 2022-05-11 at 10 43 07.

Screen Shot 2022-05-11 at 10 46 05

Could you please look into this again.

Thanks

ShantiSumanth avatar May 11 '22 09:05 ShantiSumanth

Hi @ShantiSumanth,

We will review the problem again and you will be in formed as soon as we made some improvement.

pedror19 avatar May 11 '22 10:05 pedror19

Hi again @ShantiSumanth, We figured out that you are still using the jass.conf file, you need to write the config like this.

imagen

pedror19 avatar May 11 '22 11:05 pedror19

Hello @pedror19, I've added the Kafka auth details in the java request and it is throwing java.io.ioexception Screen Shot 2022-05-11 at 13 28 43

ShantiSumanth avatar May 11 '22 12:05 ShantiSumanth

Hello again @ShantiSumanth. We will review again your problem and inform you about any improvement as soon as posible

pedror19 avatar May 11 '22 13:05 pedror19

Hi @ShantiSumanth ,

We've noticed that you are using the 3.5.3 version of KLoadGen, can you update and use the lastest version? We will continue searching for the problem, but it'd be great if you can update so we can be sure the problem is not because of an old version. One more thing, can you tell us where are you locating the jass.conf file?

jgbriz avatar May 12 '22 13:05 jgbriz

Hi @ShantiSumanth,

we were playing around a bit with Kafka Authentication, and notice you need to pass the absolute path in the java.security.auth.login.config property. It also works if you put the module configuration in a line like my colleague @pedror19 said, but, without the KafkaClient part, neither the '{'.

Can you please try after update to the latest version (if possible)?

jemacineiras avatar May 12 '22 14:05 jemacineiras

Hi @ShantiSumanth, Adding to what @jemacineiras said you need to add to the java.security.auth.login.config the serviceName field like this:

org.apache.kafka.common.security.plain.PlainLoginModule required serviceName="yourServiceName" username="(xxxxx)" password="(+dljlsjfl)";

pedror19 avatar May 12 '22 14:05 pedror19

Thanks @pedror19 @jgbriz @jemacineiras . I'm trying to get latest version of kloadgen plugin but failing to build the project. if possible would you mind providing me with latest version of kloadgen plugin please?

Thanks

ShantiSumanth avatar May 13 '22 10:05 ShantiSumanth

Hi @ShantiSumanth, Every version is deployed automatically to maven central repository, you can download the latest version from there.

pedror19 avatar May 13 '22 10:05 pedror19

Thanks @pedror19.

Ran script with latest version but still failing with same error(java.io exception and login module control flag not specified).

@jgbriz , jaas.conf file is located in jmeter/bin folder so given config file name directly in the request. Screen Shot 2022-05-13 at 16 11 19

Adding file name in java request is throwing error " java.lang.IllegalArgumentException: Login module control flag not specified in JAAS config"

giving authentication as a single string in the request is failing with exception, " java.io.IOException:org.apache.kafka.common.security.plain.PlainLoginModule required serviceName="yourServiceName" username="(xxxxx)" password="(+dljlsjfl)"; (No such file or directory)".

Screen Shot 2022-05-13 at 16 04 06

Thanks

ShantiSumanth avatar May 13 '22 15:05 ShantiSumanth

Hello @ShantiSumanth , Thank you for the information, we'll look into it.

jgbriz avatar May 16 '22 07:05 jgbriz

Hello @ShantiSumanth,

We have tested the connection and we had no problems adding to the java.security.auth.login.config the absolute path of the jaas file and the connection string directly in that field as we said previously.

test1 test2 kafka-client

pedror19 avatar May 18 '22 14:05 pedror19

Hi @pedror19,

Any update on this please?

Thanks

ShantiSumanth avatar May 23 '22 10:05 ShantiSumanth

Hello @ShantiSumanth, Have you tested the configuration above?

pedror19 avatar May 23 '22 10:05 pedror19

Hi @pedror19 ,

Sorry missed updating. Don't see login module error but failing with java.lang.SecurityException: java.io.IOException: Configuration Error.

Screen Shot 2022-05-24 at 20 16 05 Could you please have a look at this, snapshot attached.

Also have below issue whilst adding Value Schema file load generator config ERROR o.a.j.u.JMeterUtils: Cannot invoke "String.toLowerCase()" because the return value of "com.fasterxml.jackson.databind.JsonNode.textValue()" is null.

Thanks

ShantiSumanth avatar May 24 '22 19:05 ShantiSumanth

Hello @ShantiSumanth

We will look into it

pedror19 avatar May 25 '22 13:05 pedror19

Hello @ShantiSumanth ,

Can you give us more detailed information regarding the error?, so we can dig more into the problem.

jgbriz avatar May 26 '22 09:05 jgbriz

Hello @ShantiSumanth , We need more information about the error you are getting, so we can have a better look trying to get the cause of the problem.

jgbriz avatar Jun 01 '22 06:06 jgbriz

Hi @jgbriz, Apologies, lost my project so building the script again. Will give detailed information on error by eod.

Thanks

ShantiSumanth avatar Jun 07 '22 09:06 ShantiSumanth

Hi @ShantiSumanth No problem. In that case, I think it's better option to close this issue, and to reopen one in case you have other problems.

jgbriz avatar Jun 07 '22 13:06 jgbriz

Hi @jgbriz, Experiencing two issues now,

  1. failing to open Value Schema File Load Generator config. fyi... Loaded json file (file content screenshot Screen Shot 2022-06-08 at 10 52 13 attached)
  2. throwing java.io.IOException: Configuration Error, config error , think it is complaining about json file but the file is valid without errors. error details below, Caused by: java.lang.SecurityException: java.io.IOException: Configuration Error: Line 14: expected [option key], found [null] at sun.security.provider.ConfigFile$Spi.(ConfigFile.java:139) ~[?:?] at sun.security.provider.ConfigFile.(ConfigFile.java:104) ~[?:?] at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?] at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?] at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?] at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?] at java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128) ~[?:?] at jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347) ~[?:?] at java.lang.Class.newInstance(Class.java:645) ~[?:?] at javax.security.auth.login.Configuration$2.run(Configuration.java:258) ~[?:?] at javax.security.auth.login.Configuration$2.run(Configuration.java:249) ~[?:?] at java.security.AccessController.doPrivileged(AccessController.java:569) ~[?:?]
Screen Shot 2022-06-08 at 10 50 15

Please let me know if further details required for investigating.

Thanks

ShantiSumanth avatar Jun 08 '22 09:06 ShantiSumanth

Hi @ShantiSumanth , We'll look into it.

jgbriz avatar Jun 08 '22 10:06 jgbriz

Hi @ShantiSumanth,

please, can you provide the required files in order to reproduce the error? We are going to need the .jmx and .avsc ( or json schema) file you are using, or similar, in order to investigate and understand where is the problem.

Cheers

jemacineiras avatar Jun 09 '22 14:06 jemacineiras

Hi @jemacineiras, please find attached json and imx files jsonfile.json.zip CatalogueService-07June2022.jmx.zip Thanks

ShantiSumanth avatar Jun 10 '22 09:06 ShantiSumanth