berg223 commented on issue #25145:
URL: https://github.com/apache/pulsar/issues/25145#issuecomment-3811803193

   @lhotari  I have met more unexpected issues by a simple tial solution in my 
another branch named 
[fix_issue_25145_trial](https://github.com/apache/pulsar/commit/f0e7853e4abddb102fffc385051e3572dad9ff32).
 And I don't have enough time to solve the following problems before Sunday. 
   
   1. The issue still exists after 100 iteration.
   2. The cost time for every iteration increased from 49s to 90s. And new 
exception has been thrown:
   ```java
   Exception in thread "Thread-6" 
org.apache.pulsar.client.api.PulsarClientException$TimeoutException: The 
producer standalone-0-2 can not send message to the topic 
persistent://public/default/partitioned_topic_25145-partition-0 within given 
timeout : createdAt 32.415 seconds ago, firstSentAt 29.177 seconds ago, 
lastSentAt 29.177 seconds ago, retryCount 1
        at 
org.apache.pulsar.client.api.PulsarClientException.unwrap(PulsarClientException.java:1072)
        at 
org.apache.pulsar.client.impl.ProducerBase.flush(ProducerBase.java:130)
        at 
org.apache.TestScenarioIssue25145.producerTask(TestScenarioIssue25145.java:123)
        at 
org.apache.TestScenarioIssue25145.lambda$runOnce$1(TestScenarioIssue25145.java:63)
        at java.base/java.lang.Thread.run(Thread.java:1583)
   ```
   
   I have changed the trial solution from synchonized to:
   ```java
                   boolean[] hasPendingAcks = new boolean[1];
                   pendingIndividualBatchIndexAcks.compute(key, (__, bitSet) -> 
{
                       // count CAS rery times here
                       hasPendingAcks[0] = bitSet != null && 
!bitSet.get(messageIdAdv.getBatchIndex());
                       return bitSet;
                   });
                   return hasPendingAcks[0];
   ```
   It behaves same as before trial. And the CAS counter shows low competition 
and CAS has succeed over 90 percent. 
   
   4. I have no idea for the test code.
   
   I will be back to take over the remianing work this Sunday if nobody commit 
the fix PR.


-- 
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]

Reply via email to