rdhabalia opened a new issue, #22638:
URL: https://github.com/apache/pulsar/issues/22638

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### Read release policy
   
   - [X] I understand that unsupported versions don't get bug fixes. I will 
attempt to reproduce the issue on a supported version of Pulsar client and 
Pulsar broker.
   
   
   ### Version
   
   any client version
   
   ### Minimal reproduce step
   
   ```
   @Test
   public void createAsyncChangeStateIssue() throws Exception {
   
    ClientBuilder clientBuilder = PulsarClient.builder();
    clientBuilder.serviceUrl("pulsar://badUrl");
    PulsarClient client = clientBuilder.build();
    ReaderBuilder<byte[]> readerBuilder = client.newReader()
      
.topic("persistent://tenant/ns1/t1").startMessageFromRollbackDuration(100, 
TimeUnit.SECONDS);
    try {
     readerBuilder.createAsync().get(1, TimeUnit.SECONDS);
    } catch (TimeoutException e) {
     log.info("Got expected timeout exception exception, retrying");
     // The retry results in an IllegalArgumentException with message:
     //   Start message id or start message from roll back must be specified
     //   but they cannot be specified at the same time
     readerBuilder.createAsync().get(1, TimeUnit.SECONDS);
    }
   }
   ```
   
   Output:
   ```
   java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: 
Start message id or start message from roll back must be specified but they 
cannot be specified at the same time
        at 
java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
        at 
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
   Caused by: java.lang.IllegalArgumentException: Start message id or start 
message from roll back must be specified but they cannot be specified at the 
same time
        at 
org.apache.pulsar.client.impl.ReaderBuilderImpl.createAsync(ReaderBuilderImpl.java:93)
   ```
   
   ### What did you expect to see?
   
   By any chance if ReaderBuilder fails to create Reader due to connection 
issue and if application retries then it should not receive 
`java.lang.IllegalArgumentException` because there is no such argument was 
given to ReaderImpl Builder. Instead Builder should not corrupt the arguments 
and create Reader to avoid creating lot of objects in memory and avoid memory 
pressure creation.
   
   ### What did you see instead?
   
   Client gives `java.lang.IllegalArgumentException` even though there is no 
such illegal argument into the Reader Builder.
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a 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