question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Java Pulsar Producer - ProducerBuilder loadConf() throws RuntimeException when loading "maxPendingMessages" property from config map.

See original GitHub issue

Search before asking

  • I searched in the issues and found nothing similar.

Version

Pulsar version: 2.10.1

Minimal reproduce step

Add maxPendingMessages parameter into the config map and load the config.

                        HashMap<String, Object> pulsarProducerProperties = new HashMap<String, Object>();
                        pulsarProducerProperties.put("topicName", "my-topic");
                        pulsarProducerProperties.put("producerName", "my-producer");
                        pulsarProducerProperties.put("maxPendingMessages", 2000);
			pulsarProducer = pulsarClient.newProducer()
							.loadConf(pulsarProducerProperties)
							.create();

What did you expect to see?

This seems to be a regression because this seems to be working in Pulsar 2.9.2 .

What did you see instead?

A runtime exception is thrown by loadConf() method

Exception: java.lang.RuntimeException: Failed to load config into existing configuration data

If the maxPendingMessages config is removed from the map , the Producer is created but the masPendingMessages value is 0 instead of the default value of1000 as documented.

10:50:06.730 [pulsar-client-io-1-1] INFO  org.apache.pulsar.client.impl.ProducerStatsRecorderImpl - Starting Pulsar producer perf with config: {"topicName":"my-topic","producerName":"my-producer","sendTimeoutMs":30000,"blockIfQueueFull":false,"maxPendingMessages":0,"maxPendingMessagesAcrossPartitions":0,"messageRoutingMode":"RoundRobinPartition","hashingScheme":"JavaStringHash","cryptoFailureAction":"FAIL","batchingMaxPublishDelayMicros":1000,"batchingPartitionSwitchFrequencyByPublishDelay":10,"batchingMaxMessages":1000,"batchingMaxBytes":131072,"batchingEnabled":true,"chunkingEnabled":false,"compressionType":"NONE","initialSequenceId":null,"autoUpdatePartitions":true,"autoUpdatePartitionsIntervalSeconds":60,"multiSchema":true,"accessMode":"Shared","lazyStartPartitionedProducers":false,"properties":{},"initialSubscriptionName":null}

Anything else?

Tried to use the PulsarBuilder API to set the maxPendingMessages and leave some other configuration in the config map (still using loadConfig()) hit the same exception. Code snippet as below (omitted the other producer config set in the config of type HashMap<String,Object>.

			pulsarProducer = pulsarClient.newProducer()
							.topic(topicName)
							.producerName(producerName)
							.maxPendingMessages(2000)
							.loadConf(pulsarProducerProperties)
							.create();

I looked through the codes and couldn’t find exactly what is the root cause of this error. Appreciate any pointers from the community.

Are you willing to submit a PR?

  • I’m willing to submit a PR!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MarvinCaicommented, Sep 7, 2022

We should use memoryLimit instead: https://github.com/apache/pulsar/issues/13306

0reactions
tisonkuncommented, Dec 10, 2022

Closed as answered.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PIP-120: Enable client memory limit by default #13306 - GitHub
[Bug] Java Pulsar Producer - ProducerBuilder loadConf() throws RuntimeException when loading "maxPendingMessages" property from config map.
Read more >
ProducerBuilder (Pulsar Client :: API 2.4.2 API)
Load the configuration from provided config map. ProducerBuilder<T>, maxPendingMessages(int maxPendingMessages). Set the max size of the queue holding the ...
Read more >
org.apache.pulsar.client.api.ProducerBuilder.enableBatching ...
ProducerBuilder. Best Java code snippets using org.apache.pulsar.client.api. ... e) { throw new RuntimeException("Error starting LogTopic Producer", ...
Read more >
Spring for Apache Pulsar
The PulsarTemplate relies on a PulsarProducerFactory to actually create the underlying producer. Spring Boot auto-configuration also provides this producer ...
Read more >
Pulsar Producer - Portal - StreamSets Docs
Schema Properties. The destination contains properties to specify a schema on the Schema tab and the Data Format tab: Schema tab: The schema ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found