8000 NotifyCenter will throw NullPointerException when no subscriber for slowEvent · Issue #3833 · alibaba/nacos · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
NotifyCenter will throw NullPointerException when no subscriber for slowEvent #3833
Closed
@KomachiSion

Description

@KomachiSion

Describe the bug
When nacos inner publish a SlowEvent to NotifyCenter without subscribers.

the code will throw NullPointerException because get null from subscribe map

com.alibaba.nacos.common.notify.DefaultSharePublisher line 98

Set<Subscriber> subscribers = subMappings.get(slowEventType);

Expected behavior
If no subscriber for event, it should be ignore. At most print one warn log.

Acutally behavior
throw NullPointerException

[nacos.publisher-com.alibaba.nacos.common.notify.SlowEvent] ERROR com.alibaba.nacos.common.notify.NotifyCenter - Event listener exception : {}
java.lang.NullPointerException: null
	at com.alibaba.nacos.common.notify.DefaultSharePublisher.receiveEvent(DefaultSharePublisher.java:101)
	at com.alibaba.nacos.common.notify.DefaultPublisher.openEventHandler(DefaultPublisher.java:117)
	at com.alibaba.nacos.common.notify.DefaultPublisher.run(DefaultPublisher.java:94)

How to Reproduce
Steps to reproduce the behavior:

  1. NotifyCenter.publishEvent any slowEvent without subscriber
  2. See error log

Desktop (please complete the following information):

  • OS: Any
  • Version: nacos-client 1.3.2
  • Module Any
  • SDK original

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/enhancementCategory issues or prs related to enhancement.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0