Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve][broker] Don't print error logs for ProducerBusyException #23929

Merged

Conversation

RobertIndie
Copy link
Member

Motivation

When the producer's maximum count is reached, the broker will log the following error message:

2025-02-05T18:31:37,996+0800 [pulsar-io-18-16] ERROR org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:57684] Failed to create topic persistent://public/default/test2asgasgaw, producerId=1
java.util.concurrent.CompletionException: org.apache.pulsar.broker.service.BrokerServiceException$ProducerBusyException: Topic 'persistent://public/default/test2asgasgaw' reached max producers limit
	at java.base/java.util.concurrent.CompletableFuture.encodeRelay(CompletableFuture.java:368) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1189) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2309) ~[?:?]
	at org.apache.pulsar.broker.service.ServerCnx.lambda$handleProducer$34(ServerCnx.java:1586) ~[org.apache.pulsar-pulsar-broker-4.0.1.jar:4.0.1]
	at java.base/java.util.concurrent.CompletableFuture.uniApplyNow(CompletableFuture.java:684) [?:?]
	at java.base/java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:662) [?:?]
	at java.base/java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:2168) [?:?]
	at org.apache.pulsar.broker.service.ServerCnx.handleProducer(ServerCnx.java:1539) [org.apache.pulsar-pulsar-broker-4.0.1.jar:4.0.1]
	at org.apache.pulsar.common.protocol.PulsarDecoder.channelRead(PulsarDecoder.java:209) [org.apache.pulsar-pulsar-common-4.0.1.jar:4.0.1]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.handler.flow.FlowControlHandler.dequeue(FlowControlHandler.java:202) [io.netty-netty-handler-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.handler.flow.FlowControlHandler.channelRead(FlowControlHandler.java:164) [io.netty-netty-handler-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) [io.netty-netty-codec-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318) [io.netty-netty-codec-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.handler.flush.FlushConsolidationHandler.channelRead(FlushConsolidationHandler.java:152) [io.netty-netty-handler-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1357) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:868) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) [io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) [io.netty-netty-common-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [io.netty-netty-common-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [io.netty-netty-common-4.1.115.Final.jar:4.1.115.Final]
	at java.base/java.lang.Thread.run(Thread.java:840) [?:?]
Caused by: org.apache.pulsar.broker.service.BrokerServiceException$ProducerBusyException: Topic 'persistent://public/default/test2asgasgaw' reached max producers limit
	at org.apache.pulsar.broker.service.ServerCnx.lambda$handleProducer$32(ServerCnx.java:1592) ~[org.apache.pulsar-pulsar-broker-4.0.1.jar:4.0.1]
	at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1187) ~[?:?]
	... 37 more

These errors are related to the client side. The client can handle the error, so we don't need to print it in the broker log.

Modifications

  • Avoid printing the error log for the ProducerBusyException

Verifying this change

After thsi PR, no error logs will be printed if the max producer for the topic is reached:

2025-02-05T18:36:42,653+0800 [pulsar-io-16-20] WARN  org.apache.pulsar.broker.service.ServerCnx - [PersistentTopic{topic=persistent://public/default/test123}] Attempting to add producer to topic which reached max producers limit
2025-02-05T18:36:43,037+0800 [pulsar-io-16-20] INFO  org.apache.pulsar.broker.service.ServerCnx - Closed connection from /127.0.0.1:59215

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@RobertIndie RobertIndie added type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages area/broker release/3.0.10 release/3.3.5 release/4.0.3 labels Feb 5, 2025
@RobertIndie RobertIndie added this to the 4.1.0 milestone Feb 5, 2025
@RobertIndie RobertIndie self-assigned this Feb 5, 2025
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Feb 5, 2025
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RobertIndie RobertIndie merged commit 144fe2e into apache:master Feb 6, 2025
56 of 57 checks passed
@RobertIndie RobertIndie deleted the dont-print-error-max-producer branch February 6, 2025 02:07
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.21%. Comparing base (bbc6224) to head (2a8c1e0).
Report is 880 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23929      +/-   ##
============================================
+ Coverage     73.57%   74.21%   +0.63%     
+ Complexity    32624     2312   -30312     
============================================
  Files          1877     1853      -24     
  Lines        139502   143737    +4235     
  Branches      15299    16339    +1040     
============================================
+ Hits         102638   106669    +4031     
+ Misses        28908    28666     -242     
- Partials       7956     8402     +446     
Flag Coverage Δ
inttests 26.66% <ø> (+2.08%) ⬆️
systests 23.17% <ø> (-1.15%) ⬇️
unittests 73.74% <ø> (+0.89%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...va/org/apache/pulsar/broker/service/ServerCnx.java 72.85% <ø> (+0.71%) ⬆️

... and 1033 files with indirect coverage changes

RobertIndie added a commit that referenced this pull request Feb 7, 2025
…23929)

### Motivation

When the producer's maximum count is reached, the broker will log the following error message:
```
2025-02-05T18:31:37,996+0800 [pulsar-io-18-16] ERROR org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:57684] Failed to create topic persistent://public/default/test2asgasgaw, producerId=1
java.util.concurrent.CompletionException: org.apache.pulsar.broker.service.BrokerServiceException$ProducerBusyException: Topic 'persistent://public/default/test2asgasgaw' reached max producers limit
```

These errors are related to the client side. The client can handle the error, so we don't need to print it in the broker log.

### Modifications

- Avoid printing the error log for the ProducerBusyException

(cherry picked from commit 144fe2e)
RobertIndie added a commit that referenced this pull request Feb 7, 2025
…23929)

### Motivation

When the producer's maximum count is reached, the broker will log the following error message:
```
2025-02-05T18:31:37,996+0800 [pulsar-io-18-16] ERROR org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:57684] Failed to create topic persistent://public/default/test2asgasgaw, producerId=1
java.util.concurrent.CompletionException: org.apache.pulsar.broker.service.BrokerServiceException$ProducerBusyException: Topic 'persistent://public/default/test2asgasgaw' reached max producers limit
```

These errors are related to the client side. The client can handle the error, so we don't need to print it in the broker log.

### Modifications

- Avoid printing the error log for the ProducerBusyException

(cherry picked from commit 144fe2e)
RobertIndie added a commit that referenced this pull request Feb 7, 2025
…23929)

### Motivation

When the producer's maximum count is reached, the broker will log the following error message:
```
2025-02-05T18:31:37,996+0800 [pulsar-io-18-16] ERROR org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:57684] Failed to create topic persistent://public/default/test2asgasgaw, producerId=1
java.util.concurrent.CompletionException: org.apache.pulsar.broker.service.BrokerServiceException$ProducerBusyException: Topic 'persistent://public/default/test2asgasgaw' reached max producers limit
```

These errors are related to the client side. The client can handle the error, so we don't need to print it in the broker log.

### Modifications

- Avoid printing the error log for the ProducerBusyException

(cherry picked from commit 144fe2e)
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Feb 10, 2025
…pache#23929)

### Motivation

When the producer's maximum count is reached, the broker will log the following error message:
```
2025-02-05T18:31:37,996+0800 [pulsar-io-18-16] ERROR org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:57684] Failed to create topic persistent://public/default/test2asgasgaw, producerId=1
java.util.concurrent.CompletionException: org.apache.pulsar.broker.service.BrokerServiceException$ProducerBusyException: Topic 'persistent://public/default/test2asgasgaw' reached max producers limit
```

These errors are related to the client side. The client can handle the error, so we don't need to print it in the broker log.

### Modifications

- Avoid printing the error log for the ProducerBusyException

(cherry picked from commit 144fe2e)
hanmz pushed a commit to hanmz/pulsar that referenced this pull request Feb 12, 2025
…pache#23929)

### Motivation

When the producer's maximum count is reached, the broker will log the following error message:
```
2025-02-05T18:31:37,996+0800 [pulsar-io-18-16] ERROR org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:57684] Failed to create topic persistent://public/default/test2asgasgaw, producerId=1
java.util.concurrent.CompletionException: org.apache.pulsar.broker.service.BrokerServiceException$ProducerBusyException: Topic 'persistent://public/default/test2asgasgaw' reached max producers limit
```

These errors are related to the client side. The client can handle the error, so we don't need to print it in the broker log.

### Modifications

- Avoid printing the error log for the ProducerBusyException
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/broker cherry-picked/branch-3.0 cherry-picked/branch-3.3 cherry-picked/branch-4.0 doc-not-needed Your PR changes do not impact docs ready-to-test release/3.0.10 release/3.3.5 release/4.0.3 type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants