Azure / Azure/azure-service-bus-java

TimeoutException: UpdateState request timed out in version 1.2.8

Open
#312 7 comments 0 reactions 1 assignee Claimed by @yvgopal View on GitHub
question
Dominant language
Java
Stars
62
Forks
63
PR merge metrics
No merged PRs in 30d

Description

Hay

I've recently updated our source to use the 1.2.8 version and I in our production environment we get strange issues. After a random number of days the subscription client starts producing TimeoutExceptions with message "UpdateState request timed out. Delivery:?????????".

The application processes the message successfully but the final call to the service bus to ack the message fails. This results in endless processing of messages.

I've been reading an existing issue [#272](https://github.com/Azure/azure-service-bus-java/issues/272) and implemented our application in the recommended way.

Registration
```
private void receiveSubscriptionMessages() throws ServiceBusException, InterruptedException {
final MessageHandlerOptions options = new MessageHandlerOptions( 10, false, Duration.ofMinutes( 5 ) );
final ExecutorService executor = Executors.newFixedThreadPool( options.getMaxConcurrentCalls() );
subscriptionClient.registerMessageHandler( new MessageHandler(), options, executor );
log.info( "Registered to subscription" );
}
```
Handler
```
private class MessageHandler implements IMessageHandler {
@Override
public CompletableFuture onMessageAsync( final IMessage message ) {
log.info( "New message {}", message.getMessageId() );
final CompletableFuture future = new CompletableFuture<>();
process( future, message );
return future;
}

@Override
public void notifyException( final Throwable exception, final ExceptionPhase phase ) {
log.error( phase + " encountered exception:" + exception.getMessage(), exception );
}
}
```
Processor
```
private void process( final CompletableFuture future, final IMessage message ) {
try {
try {
// logic
future.complete( null );
} catch ( final RetryableException e ) {
future.completeExceptionally( e );
} catch ( final ValidationException | NonRetryableException e ) {
// can't handle message, send to deadletter queue
log.error( "Poison message {}, sending to deadletter queue", message.getMessageId() );
subscriptionClient.deadLetter( message.getLockToken() );
future.complete( null );
}
} catch ( final InterruptedException | ServiceBusException e ) {
// catch exceptions in service bus communication
future.completeExceptionally( e );
} catch ( final Exception e ) {
// unhandled exception, should not occur
future.completeExceptionally( e );
}
}

```

Any idea how to resolve this issue?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.