Skip to content

[BUG] Servicebus-Java ''Timeout on blocking read' when sending messages' #44688

@cristibozga

Description

@cristibozga

We are migration from the old servicebus sdk to the new one and after the first deployment we had several errors.
One of them is:

{"@timestamp":"2025-03-12T05:16:18.384Z","@version":"1","message":"Unhandled exception from message handler method","logger_name":"com.alpega.azure.servicebus.listener.handler.ServiceBusQueueMessageHandler","thread_name":"boundedElastic-1180","level":"ERROR","level_value":40000,"stack_trace":"org.springframework.messaging.MessageDeliveryException: Failed to send message to MyMessageChannel[MyMessageChannel@4d73a5d8]; nested exception is java.lang.IllegalStateException: Timeout on blocking read for 10400000000 NANOSECONDS\n\tat org.springframework.messaging.support.AbstractMessageChannel.send(AbstractMessageChannel.java:149)...

or

  {"@timestamp":"2025-03-12T05:16:19.302Z","@version":"1","message":"Exception processing message on queue WebhookNotificationBookingEventAcceptedQueue. Operation USER_CALLBACK","logger_name":"com.alpega.azure.servicebus.listener.handler.ServiceBusQueueErrorConsumer","thread_name":"boundedElastic-1183","level":"ERROR","level_value":40000,"stack_trace":"com.azure.messaging.servicebus.ServiceBusException: An exception occurred while invoking the handler method; nested exception is org.springframework.messaging.MessageDeliveryException: Failed to send message to MyMessageChannel[MyMessageChannel@4d73a5d8]; nested exception is java.lang.IllegalStateException: Timeout on blocking read for 10400000000 NANOSECONDS, failedMessage=GenericMessage [payload={...} \tat com.azure.messaging.servicebus.MessagePump.notifyMessage(MessagePump.java:165)\n\tat com.azure.messaging.servicebus.MessagePump.lambda$handleMessage$3(MessagePump.java:148)\n\tat com.azure.messaging.servicebus.implementation.instrumentation.ServiceBusReceiverInstrumentation.wrap(ServiceBusReceiverInstrumentation.java:176)\n\tat com.azure.messaging.servicebus.implementation.instrumentation.ServiceBusReceiverInstrumentation.instrumentProcess(ServiceBusReceiverInstrumentation.java:106)\n\tat com.azure.messaging.servicebus.MessagePump.handleMessage(MessagePump.java:141)\n\tat com.azure.messaging.servicebus.MessagePump$RunOnWorker.lambda$apply$0(MessagePump.java:226)\n\tat reactor.core.publisher.MonoRunnable.subscribe(MonoRunnable.java:49)\n\tat reactor.core.publisher.Mono.subscribe(Mono.java:4490)\n\tat reactor.core.publisher.MonoSubscribeOn$SubscribeOnSubscriber.run(MonoSubscribeOn.java:126)\n\tat io.opentelemetry.javaagent.shaded.instrumentation.reactor.v3_1.ContextPropagationOperator$RunnableWrapper.run(ContextPropagationOperator.java:373)\n\tat reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84)\n\tat reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37)

Here's the setup of the sender:

public ServiceBusSenderClient prepareSender(String queueName) {
        return new ServiceBusClientBuilder()
                .connectionString(....)
                .retryOptions(RETRY_OPTIONS)
                .sender()
                .queueName(queueName)
                .buildClient();

    }

RETRY_OPTIONS are created using this code:

    Long TIMEOUT = 10000L;
    AmqpRetryOptions RETRY_OPTIONS=prepareRetryOptions();

    ServiceBusSenderClient prepareSender(String entityName);


    static AmqpRetryOptions prepareRetryOptions() {
        AmqpRetryOptions retryOptions = new AmqpRetryOptions();
        retryOptions.setMode(AmqpRetryMode.FIXED);
        retryOptions.setTryTimeout(Duration.ofMillis(TIMEOUT));
        return retryOptions;
    }

Sdk version: 7.17.7
Java version: 17

Where from the 10400000000 NANOSECONDS timeout comes and how can we avoid it?

Thanks,
Cristi

Metadata

Metadata

Labels

ClientThis issue points to a problem in the data-plane of the library.Service BusbugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions