Skip to content

[BUG] NPE #46325

Closed
Closed

Description

@cristibozga

Describe the bug
I discivered in our logs a bug related to servicebus library.
SDK version: 7.17.12

Exception or Stack Trace
reactor.core.Exceptions$ErrorCallbackNotImplemented: java.lang.NullPointerException: Cannot invoke "java.util.concurrent.atomic.AtomicBoolean.getAndSet(boolean)" because "this.isDisposed" is null
Caused by: java.lang.NullPointerException: Cannot invoke "java.util.concurrent.atomic.AtomicBoolean.getAndSet(boolean)" because "this.isDisposed" is null
at com.azure.messaging.servicebus.implementation.ServiceBusReactorReceiver.closeAsync(ServiceBusReactorReceiver.java:199)
at com.azure.core.amqp.implementation.ReactorReceiver.lambda$new$12(ReactorReceiver.java:203)
at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:386)
at io.opentelemetry.javaagent.shaded.instrumentation.reactor.v3_1.TracingSubscriber.onNext(TracingSubscriber.java:68)
at io.opentelemetry.javaagent.shaded.instrumentation.reactor.v3_1.TracingSubscriber.onNext(TracingSubscriber.java:68)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1839)
at reactor.core.publisher.MonoCacheTime$CoordinatorSubscriber.signalCached(MonoCacheTime.java:337)
at reactor.core.publisher.MonoCacheTime$CoordinatorSubscriber.onNext(MonoCacheTime.java:354)
at reactor.core.publisher.Operators$MonoInnerProducerBase.complete(Operators.java:2636)
at reactor.core.publisher.SinkOneMulticast.subscribe(SinkOneMulticast.java:99)
at reactor.core.publisher.MonoCacheTime.subscribeOrReturn(MonoCacheTime.java:143)
at reactor.core.publisher.Flux.subscribe(Flux.java:8628)
at reactor.core.publisher.Flux.subscribeWith(Flux.java:8815)
at reactor.core.publisher.Flux.subscribe(Flux.java:8608)
at reactor.core.publisher.Flux.subscribe(Flux.java:8532)
at reactor.core.publisher.Flux.subscribe(Flux.java:8450)
at com.azure.core.amqp.implementation.ReactorReceiver.(ReactorReceiver.java:204)
at com.azure.messaging.servicebus.implementation.ServiceBusReactorReceiver.(ServiceBusReactorReceiver.java:76)
at com.azure.messaging.servicebus.implementation.ServiceBusAmqpLinkProvider.createReceiveLink(ServiceBusAmqpLinkProvider.java:45)
at com.azure.core.amqp.implementation.ConsumerFactory.createConsumer(ConsumerFactory.java:64)
at com.azure.core.amqp.implementation.ReactorSession.getSubscription(ReactorSession.java:672)
at com.azure.core.amqp.implementation.ReactorSession.lambda$createConsumer$11(ReactorSession.java:448)
at java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1916)
at com.azure.core.amqp.implementation.ReactorSession.lambda$createConsumer$12(ReactorSession.java:434)
at com.azure.core.amqp.implementation.handler.DispatchHandler.onTimerTask(DispatchHandler.java:32)
at com.azure.core.amqp.implementation.ReactorDispatcher$WorkScheduler.run(ReactorDispatcher.java:219)
at org.apache.qpid.proton.reactor.impl.SelectableImpl.readable(SelectableImpl.java:118)
at org.apache.qpid.proton.reactor.impl.IOHandler.handleQuiesced(IOHandler.java:61)
at org.apache.qpid.proton.reactor.impl.IOHandler.onUnhandled(IOHandler.java:398)
at org.apache.qpid.proton.engine.BaseHandler.onReactorQuiesced(BaseHandler.java:87)
at org.apache.qpid.proton.engine.BaseHandler.handle(BaseHandler.java:206)
at org.apache.qpid.proton.engine.impl.EventImpl.dispatch(EventImpl.java:108)
at org.apache.qpid.proton.reactor.impl.ReactorImpl.dispatch(ReactorImpl.java:324)
at org.apache.qpid.proton.reactor.impl.ReactorImpl.process(ReactorImpl.java:292)
at com.azure.core.amqp.implementation.ReactorExecutor.run(ReactorExecutor.java:91)
at io.opentelemetry.javaagent.shaded.instrumentation.reactor.v3_1.ContextPropagationOperator$RunnableWrapper.run(ContextPropagationOperator.java:373)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)

To Reproduce
I can't reproduce it locally. I don't know why it happens.
Ialso see we have a lot of errors like this:

com.azure.core.amqp.exception.AmqpException: The operation did not complete within the allotted timeout of 00:00:09. The time allotted to this operation may have been a portion of a longer timeout. For more information on exception types and proper exception handling, please refer to https://aka.ms/ServiceBusExceptions . TrackingId:b9845c9e-ff60-406a-a019-3791539096df_B4, SystemTracker:gi::G0:852012554:session-_5e9a38_1754641630975, bi::link17259775(852012557_G0), Timestamp:2025-08-08T08:27:20 TrackingId:601dc5c7b2974d6391632461b29f7f8b_G0, SystemTracker:gateway10, Timestamp:2025-08-08T08:27:20, errorContext[NAMESPACE: sbus-nonprod-sprint-main-pextnk.servicebus.windows.net. ERROR CONTEXT: N/A, PATH: slot_delivery_events_subscription_queue, REFERENCE_ID: session-_5e9a38_1754641630975, LINK_CREDIT: 0]

Code Snippet
Code to create listener:
private ServiceBusProcessorClient createQueueConsumer(String queuePath, QueueListenerProperties queueListenerProperties) {

    ServiceBusClientBuilder.ServiceBusProcessorClientBuilder builder = new ServiceBusClientBuilder()
            .connectionString(serviceBusProperties.getConnectionString())
            .retryOptions(retryOptions(queueListenerProperties))
            .processor()
            .maxConcurrentCalls(20)
            .queueName(queuePath);
    builder.processMessage(messageHandler);
    builder.processError(errorHandler);
    return builder.buildProcessorClient();
}

private static AmqpRetryOptions retryOptions(QueueListenerProperties properties) {
    AmqpRetryOptions o = new AmqpRetryOptions();
    o.setTryTimeout(Duration.ofSeconds(10);
    o.setMode(AmqpRetryMode.FIXED);
    return o;
}

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

  • OS: Azure AKS
  • IDE: [e.g. IntelliJ]
  • Library/Libraries: [e.g. com.azure:azure-core:1.16.0 (groupId:artifactId:version)]
  • Java version: 17
  • App Server/Environment: Azure AKS
  • Frameworks: Spring Boot 2.7

Additional context
Add any other context about the problem here.

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added

Activity

  1. added
    ClientThis issue points to a problem in the data-plane of the library.
    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
    questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
    on Aug 8, 2025
  2. github-actions commented on Aug 8, 2025

    @github-actions
    Contributor
  3. github-actions commented on Aug 8, 2025

    @github-actions
    Contributor

    Thank you for your feedback. Tagging and routing to the team member best able to assist.

  4. added
    bugThis issue requires a change to an existing behavior in the product in order to be resolved.
    and removed
    questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
    on Sep 30, 2025
  5. conniey commented on Nov 3, 2025

    @conniey
    Member

    Do you have a repro?

    Looking our code base, the variable causing the NullPointerException is private final AtomicBoolean isDisposed = new AtomicBoolean(); and we never reassign its value.

  6. cristibozga commented on Nov 5, 2025

    @cristibozga
    Author

    Hi. I cannot reproduce it locally. I can provide you information about when and where it occurred so you can check the data. BU as you see, the event reported was 3 months ago

  7. samvaity commented on Nov 13, 2025

    @samvaity
    Member

    Connie Yau (@conniey) Do you have any updates?
    cristibozga Do you still have this issue considering the bug was opened 3 months ago?

  8. cristibozga commented on Nov 14, 2025

    @cristibozga
    Author

    I don't have any news about it. I guess we can close it

  9. locked and limited conversation to collaborators on Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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