spring-projects / spring-projects/spring-data-redis
`StringRedisConnection` returns `null` using read operations during transactions
Open
Nobody has claimed this yet.
type: bug
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
A minimize cases as belong, which expect return some value but get null。
@GetMapping("/get")
@Transactional
public String get(@RequestParam String key) {
String value = stringRedisTemplate.opsForValue().get(key);
System.out.println(value);
return value;
}
DefaultStringConnection hold LettuceRedisConnection with multi = true, result isFutureConversion() always return true
@Nullable
private <T> T convertAndReturn(@Nullable Object value, Converter converter) {
if (isFutureConversion()) {
addResultConverter(converter);
return null;
}
if (!(converter instanceof ListConverter) && value instanceof List) {
return (T) new ListConverter<>(converter).convert((List) value);
}
return value == null ? null
: ObjectUtils.nullSafeEquals(converter, Converters.identityConverter()) ? (T) value
: (T) converter.convert(value);
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with DefaultStringConnection.convertAndReturn and the LettuceRedisConnection transaction path described in the report. Reproduce the shown StringRedisTemplate.opsForValue().get call inside @Transactional, then verify the expected read result and add or update coverage for transaction behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, redis, spring
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100