GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — io.grpc.xds.SharedCallCounterMap.cleanQueue() NullPointerException · Issue #8397 · grpc/grpc-java

io.grpc.xds.SharedCallCounterMap.cleanQueue() NullPointerException #8397

New issue
Copy link
New issue
Copy link
Closed
#8466
Closed
io.grpc.xds.SharedCallCounterMap.cleanQueue() NullPointerException#8397
#8466
Copy link
Assignees
dapengzhang0
Labels
bug
Milestone
1.41

Description

@sky91
sky91
opened on Aug 9, 2021
Issue body actions

Version: v1.38.1
Env: Linux, Jdk8

It happened to grpc client with xds enabled:

io.grpc.StatusRuntimeException: INTERNAL: Panic! This is a bug!
        at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:262)
        at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:243)
        at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:156)
        ......
Caused by: java.lang.NullPointerException: null
        at io.grpc.xds.SharedCallCounterMap.cleanQueue(SharedCallCounterMap.java:76)
        at io.grpc.xds.SharedCallCounterMap.getOrCreate(SharedCallCounterMap.java:67)
        at io.grpc.xds.ClusterImplLoadBalancer.handleResolvedAddresses(ClusterImplLoadBalancer.java:124)
        at io.grpc.util.ForwardingLoadBalancer.handleResolvedAddresses(ForwardingLoadBalancer.java:46)
        at io.grpc.xds.PriorityLoadBalancer$ChildLbState.updateResolvedAddresses(PriorityLoadBalancer.java:269)
        at io.grpc.xds.PriorityLoadBalancer.tryNextPriority(PriorityLoadBalancer.java:136)
        at io.grpc.xds.PriorityLoadBalancer.handleResolvedAddresses(PriorityLoadBalancer.java:102)
        at io.grpc.xds.ClusterResolverLoadBalancer$ClusterResolverLbState.handleEndpointResourceUpdate(ClusterResolverLoadBalancer.java:246)
        at io.grpc.xds.ClusterResolverLoadBalancer$ClusterResolverLbState.access$1600(ClusterResolverLoadBalancer.java:157)
        at io.grpc.xds.ClusterResolverLoadBalancer$ClusterResolverLbState$EdsClusterState$1EndpointsUpdated.run(ClusterResolverLoadBalancer.java:427)
        at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:95)
        at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:127)
        at io.grpc.xds.ClusterResolverLoadBalancer$ClusterResolverLbState$EdsClusterState.onChanged(ClusterResolverLoadBalancer.java:431)
        at io.grpc.xds.ClientXdsClient$ResourceSubscriber.notifyWatcher(ClientXdsClient.java:1562)
        at io.grpc.xds.ClientXdsClient$ResourceSubscriber.onData(ClientXdsClient.java:1515)
        at io.grpc.xds.ClientXdsClient.handleResourcesAccepted(ClientXdsClient.java:1379)
        at io.grpc.xds.ClientXdsClient.handleEdsResponse(ClientXdsClient.java:982)
        at io.grpc.xds.AbstractXdsClient$AbstractAdsStream.handleRpcResponse(AbstractXdsClient.java:504)
        at io.grpc.xds.AbstractXdsClient$AdsStreamV3$1$1.run(AbstractXdsClient.java:663)
        at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:95)
        at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:127)
        at io.grpc.xds.AbstractXdsClient$AdsStreamV3$1.onNext(AbstractXdsClient.java:655)
        at io.grpc.xds.AbstractXdsClient$AdsStreamV3$1.onNext(AbstractXdsClient.java:652)
        at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onMessage(ClientCalls.java:465)
        at io.grpc.internal.DelayedClientCall$DelayedListener.onMessage(DelayedClientCall.java:447)
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInternal(ClientCallImpl.java:652)
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInContext(ClientCallImpl.java:637)
        at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
        at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        ... 1 common frames omitted

I failed to find the exact steps to reproduce this exception. But it almost always happens in my long-running server application.

Activity

  1. dapengzhang0 commented on Aug 9, 2021

    @dapengzhang0
    dapengzhang0
    on Aug 9, 2021
    Contributor
    More actions

    It's likely a bug. Because SharedCallCounterMap uses WeakReference, I believe it's hard to reproduce. Thanks for reporting, I'll have a look.

  2. ejona86
    added
    bug
    on Aug 9, 2021
  3. ejona86 commented on Aug 9, 2021

    @ejona86
    ejona86
    on Aug 9, 2021
    Member
    More actions

    I expect clusterCounter == null during cleanQueue(). cleanQueue isn't synchronized, so it seems it could maybe remove an entry from counters during getOrCreate(), between the counters.get() and the clusterCounters.put().

  4. dapengzhang0
    self-assigned this
    on Aug 10, 2021
  5. ejona86
    added this to the 1.41 milestone on Aug 10, 2021
  6. dapengzhang0
    modified the milestones: 1.41, Next on Sep 1, 2021
  7. dapengzhang0
    closed this as completedin #8466on Sep 2, 2021
  8. dapengzhang0
    added a commit that references this issue on Sep 2, 2021

    xds: Fix WeakReference bug in SharedCallCounterMap (#8466)

    This issue will close once commit 07747c5 is merged into the 'master' branch.
    07747c5
  9. dapengzhang0 commented on Sep 2, 2021

    @dapengzhang0
    dapengzhang0
    on Sep 2, 2021
    Contributor
    More actions

    But it almost always happens in my long-running server application.

    @sky91 The fix will be available in v1.41 release. Let us know if you need the fix to be backported in earlier versions.

  10. dapengzhang0
    added 2 commits that reference this issue on Sep 2, 2021

    xds: Fix WeakReference bug in SharedCallCounterMap (grpc#8466)

    This issue will close once commit ddcccd9 is merged into the 'master' branch.
    ddcccd9

    xds: Fix WeakReference bug in SharedCallCounterMap (#8466)

    This issue will close once commit fcffe92 is merged into the 'master' branch.
    fcffe92
  11. sky91 commented on Sep 6, 2021

    @sky91
    sky91
    on Sep 6, 2021
    Author
    More actions

    The fix will be available in v1.41 release. Let us know if you need the fix to be backported in earlier versions.

    @dapengzhang0 I will upgrage to v1.41 then. Thanks.

  12. github-actions
    locked as resolved and limited conversation to collaborators on Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dapengzhang0
    dapengzhang0

Labels

bug

Type

No type

Projects

No projects

    Milestone

    • 1.41

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402792 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.