alibaba / alibaba/Sentinel

[BUG] springcloud-gateway sentinel 1.8.6版本报空指针异常

Open
#3,556 3 comments 0 reactions 0 assignees View on GitHub
good first issue kind/bug
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

## Issue Description

Type: *bug report*

### Describe what happened

### Describe what you expected to happen

### How to reproduce it (as minimally and precisely as possible)

1. springcloud-gateway 3.1.4版本使用sentinel 1.8.6版本运行时会报空指针异常
2. sentinel相关依赖如下所示:


com.alibaba.cloud
spring-cloud-starter-alibaba-sentinel


com.alibaba.csp
sentinel-datasource-nacos
1.8.6


com.alibaba.cloud
spring-cloud-alibaba-sentinel-gateway

4. 异常如下所示:
java.lang.NullPointerException: value
at java.base/java.util.Objects.requireNonNull(Objects.java:246) ~[na:na]
at reactor.util.context.Context2.put(Context2.java:46) ~[reactor-core-3.4.24.jar:3.4.24]
at com.alibaba.csp.sentinel.adapter.reactor.SentinelReactorSubscriber.currentContext(SentinelReactorSubscriber.java:70) ~[sentinel-reactor-adapter-1.8.6.jar:na]
at com.alibaba.csp.sentinel.adapter.reactor.SentinelReactorSubscriber.currentContext(SentinelReactorSubscriber.java:69) ~[sentinel-reactor-adapter-1.8.6.jar:na]
at reactor.core.publisher.FluxPeek$PeekSubscriber.currentContext(FluxPeek.java:120) ~[reactor-core-3.4.24.jar:3.4.24]
at reactor.core.publisher.InnerOperator.currentContext(InnerOperator.java:33) ~[reactor-core-3.4.24.jar:3.4.24]
at reactor.core.publisher.InnerOperator.currentContext(InnerOperator.java:33) ~[reactor-core-3.4.24.jar:3.4.24]
at reactor.core.publisher.InnerOperator.currentContext(InnerOperator.java:33) ~[reactor-core-3.4.24.jar:3.4.24]

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported setup with Spring Cloud Gateway 3.1.4, Sentinel 1.8.6, and Reactor 3.4.24, then read sentinel-reactor-adapter's SentinelReactorSubscriber.java around currentContext at line 70. Trace why the value passed to Reactor Context2.put is null; done means the gateway no longer raises this NullPointerException in the reported setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.