alibaba / alibaba/jetcache

CacheUtil偶现空指针异常

Open
#768 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
5.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

jetcache版本:2.6.0
spring版本:5.2.10.RELEASE.jar
spring-boot版本:2.3.5.RELEASE
redis使用sentinel部署方式

线上运行中偶现报空指针,偶现且无法稳定复现,报错频率还挺高。整个工程未使用jetcache的computeIfAbsent方法,只使用了jetcache注解做3级缓存
例如
```
@Cached(name = "xxx", key = "#id", expire = 3600, cacheType = CacheType.BOTH)
```

错误堆栈
```
Caused by: java.lang.NullPointerException
at com.alicp.jetcache.CacheUtil.lambda$createProxyLoader$0(CacheUtil.java:82) ~[jetcache-core-2.6.0.jar!/:?]
at com.alicp.jetcache.CacheLoader.apply(CacheLoader.java:31) ~[jetcache-core-2.6.0.jar!/:?]
at com.alicp.jetcache.AbstractCache.computeIfAbsentImpl(AbstractCache.java:178) ~[jetcache-core-2.6.0.jar!/:?]
at com.alicp.jetcache.RefreshCache.computeIfAbsent(RefreshCache.java:58) ~[jetcache-core-2.6.0.jar!/:?]
at com.alicp.jetcache.RefreshCache.computeIfAbsent(RefreshCache.java:53) ~[jetcache-core-2.6.0.jar!/:?]
at com.alicp.jetcache.anno.method.CacheHandler.invokeWithCached(CacheHandler.java:250) ~[jetcache-anno-2.6.0.jar!/:?]
at com.alicp.jetcache.anno.method.CacheHandler.doInvoke(CacheHandler.java:93) ~[jetcache-anno-2.6.0.jar!/:?]
at com.alicp.jetcache.anno.method.CacheHandler.invoke(CacheHandler.java:85) ~[jetcache-anno-2.6.0.jar!/:?]
at com.alicp.jetcache.anno.aop.JetCacheInterceptor.invoke(JetCacheInterceptor.java:80) ~[jetcache-anno-2.6.0.jar!/:?]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.10.RELEASE.jar!/:5.2.10.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.10.RELEASE.jar!/:5.2.10.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691) ~[spring-aop-5.2.10.RELEASE.jar!/:5.2.10.RELEASE]
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at CacheUtil.java line 82, then trace the CacheLoader.apply and AbstractCache.computeIfAbsentImpl frames in the supplied stack trace. Reproduce with JetCache 2.6.0, Spring 5.2.10, Spring Boot 2.3.5, Redis Sentinel, and the shown @Cached CacheType.BOTH usage. Done means identifying the null value's cause and confirming the intermittent failure no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, redis, spring, spring-boot
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.