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

Duplicate messages are published and throws TimeoutException #2175

Open
sann3 opened this issue Sep 17, 2024 · 0 comments
Open

Duplicate messages are published and throws TimeoutException #2175

sann3 opened this issue Sep 17, 2024 · 0 comments
Assignees
Labels
api: pubsub Issues related to the googleapis/java-pubsub API.

Comments

@sann3
Copy link

sann3 commented Sep 17, 2024

Environment details

  1. google-cloud-pubsub
  2. Linux version 5.15.153.1-microsoft-standard-WSL2
  3. Java Corretto-21.0.3.9.1 (build 21.0.3+9-LTS)
  4. version(s): com.google.cloud:google-cloud-pubsub:1.131.0

Steps to reproduce

  1. Some times a message is published multiple times (upto 7 times), since it is not getting the acknowledge back. Finally getting timeout exception.
  2. Not happening always, only happens to some random messages

Code example

    application.yaml
      max-buffered-messages: 1
      initial-retry-delay-in-millis: 100
      retry-delay-multiplier: 2.0
      max-retry-delay-in-seconds: 60
      initial-rpc-timeout-in-seconds: 1
      rpc-timeout-multiplier: 1.0
      max-rpc-timeout-in-seconds: 600
      total-timeout-in-seconds: 600

       RetrySettings defaultRetrySettings =
                RetrySettings.newBuilder()
                        .setInitialRetryDelay(
                                Duration.ofMillis(pubSubProperties.getInitialRetryDelayInMillis()))
                        .setRetryDelayMultiplier(pubSubProperties.getRetryDelayMultiplier())
                        .setMaxRetryDelay(
                                Duration.ofSeconds(pubSubProperties.getMaxRetryDelayInSeconds()))
                        .setInitialRpcTimeout(
                                Duration.ofSeconds(
                                        pubSubProperties.getInitialRpcTimeoutInSeconds()))
                        .setRpcTimeoutMultiplier(pubSubProperties.getRpcTimeoutMultiplier())
                        .setMaxRpcTimeout(
                                Duration.ofSeconds(pubSubProperties.getMaxRpcTimeoutInSeconds()))
                        .setTotalTimeout(
                                Duration.ofSeconds(pubSubProperties.getTotalTimeoutInSeconds()))
                        .build();
        Publisher publisher =
                builder.setEnableMessageOrdering(true)
                        .setRetrySettings(defaultRetrySettings)
                        .build();
        ApiFuture<String> future = publisher.publish(pubsubMessage);
        future.get(5000, TimeUnit.MILLISECONDS);

Stack trace

java.util.concurrent.TimeoutException: Waited 5000 milliseconds (plus 182053 nanoseconds delay) for com.google.api.core.AbstractApiFuture$InternalSettableFuture@4aa80674[status=PENDING]
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:533)
	at com.google.api.core.AbstractApiFuture.get(AbstractApiFuture.java:58)
	at com.company.feature.pubsub.PublisherDelegate.publishDataToPubSub(PublisherDelegate.java:91)
	... 134 common frames omitted
@product-auto-label product-auto-label bot added the api: pubsub Issues related to the googleapis/java-pubsub API. label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/java-pubsub API.
Projects
None yet
Development

No branches or pull requests

2 participants