poorbarcode opened a new pull request, #21134:
URL: https://github.com/apache/pulsar/pull/21134
### Motivation
#### Before #19446
If producer sending and topic unloading are executed at the same time, there
are three scenarios:
- The Broker receives the send command before unloading the topic
- Broker responds successfully after writing even if the Producer is
already marked closed.
- The client marks the send command as finished even if the connection is
transferred to another one.
- The Broker receives the send command after unloading the topic
- Broker trigger close the socket
- The client marks all pending requests as failed after the socket closed.
#### After #19446, scenario 2 changed
- The Broker receives the send command after unloading the topic
- Broker discards this send command and responds nothing.
- The send command will not finish until the timeout
We received more than `20,000` errors in three hours.

```
[Pulsar][Producer]Asynchronous message sending failed:
org.apache.pulsar.client.api.PulsarClientException$TimeoutException: The
producer service-TestProducer-02586a can not send message to the topic
persistent://public/default/test-partition-2 within given timeout : createdAt
22.195 seconds ago, firstSentAt 7484.289 seconds ago, lastSentAt 7484.289
seconds ago, retryCount 0
at
org.apache.pulsar.client.impl.ProducerImpl$OpSendMsg.sendComplete(ProducerImpl.java:1386)
at
org.apache.pulsar.client.impl.ProducerImpl.lambda$failPendingMessages$19(ProducerImpl.java:1931)
at java.base/java.util.ArrayDeque.forEach(ArrayDeque.java:889)
at
org.apache.pulsar.client.impl.ProducerImpl$OpSendMsgQueue.forEach(ProducerImpl.java:1476)
at
org.apache.pulsar.client.impl.ProducerImpl.failPendingMessages(ProducerImpl.java:1921)
at
org.apache.pulsar.client.impl.ProducerImpl.run(ProducerImpl.java:1900)
at
org.apache.pulsar.shade.io.netty.util.HashedWheelTimer$HashedWheelTimeout.run(HashedWheelTimer.java:715)
at
org.apache.pulsar.shade.io.netty.util.concurrent.ImmediateExecutor.execute(ImmediateExecutor.java:34)
at
org.apache.pulsar.shade.io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:703)
at
org.apache.pulsar.shade.io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:790)
at
org.apache.pulsar.shade.io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:503)
at
org.apache.pulsar.shade.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:955)
```
### Modifications
Revert #19446
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update
later -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
### Matching PR in forked repository
PR in forked repository: x
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]