Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JCache hangs forever when getting value from cache with useScriptCache=true #4276

Closed
theigl opened this issue May 5, 2022 · 3 comments
Closed
Labels
Milestone

Comments

@theigl
Copy link
Contributor

theigl commented May 5, 2022

Expected behavior

Getting a value from JCache works.

Actual behavior

Since Redisson 3.17.0, the get operation on a cache hangs forever if useScriptCache is set to true. It works until 3.16.8.

Steps to reproduce or test case

public class JCacheTest extends NoTxTestCase {

	private static final String CACHE_PROVIDER = JCachingProvider.class.getName();

	private static final int TTL = 5000;
	private static final int MAX_IDLE_TIME = 0;
	private static final String ANY_CACHE = "myCache";
	private static final String ANY_KEY = "anyKey";
	private static final String ANY_VALUE = "anyValue";

	@Inject
	private RedissonClient redissonClient;

	@Test
	void shouldGetCacheValue() {
		final Configuration<Object, Object> cfg = RedissonConfiguration.fromInstance(redissonClient,
				BaseCacheConfiguration.RedisCacheConfiguration.createConfiguration(new CacheConfig(TTL, MAX_IDLE_TIME)));
		final Cache<Object, Object> cache = createCache(ANY_CACHE, cfg);
		cache.put(ANY_KEY, ANY_VALUE);

		cache.get(ANY_KEY);
	}

	private static Cache<Object, Object> createCache(String cacheName, Configuration<Object, Object> configuration) {
		final CachingProvider p = Caching.getCachingProvider(CACHE_PROVIDER);
		final CacheManager cm = p.getCacheManager();
		return cm.createCache(cacheName, configuration);
	}
}

Redis version

4.0.10

Redisson version

3.17.0

Redisson configuration

	public RedissonClient createClient(Optional<EmbeddedRedisServer> embeddedRedisServer) {
		final Config cfg = new Config();
		cfg.setUseScriptCache(true);
		cfg.useSingleServer()
				.setAddress(this.redisAddress)
				.setPassword(Strings.emptyToNull(redisPassword));
		return Redisson.create(cfg);
	}
@mrniko mrniko added this to the 3.17.2 milestone May 5, 2022
@mrniko mrniko added the bug label May 5, 2022
@snap
Copy link

snap commented May 5, 2022

I have the same issue. In my case the first call to use the script hangs forever (using Reactor no signal is ever emitted). Subsequent calls work as expected. In my case I'm not using JCache, just a straight up call via Redisson.

@mrniko
Copy link
Member

mrniko commented May 6, 2022

@snap

Can you share some example code?

@mrniko
Copy link
Member

mrniko commented May 17, 2022

Fixed. Thanks for report

@mrniko mrniko closed this as completed May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants