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

Redis cannot used in secure mode with APIM throttling. #1887

Closed
janithcmw opened this issue Jun 1, 2023 · 0 comments
Closed

Redis cannot used in secure mode with APIM throttling. #1887

janithcmw opened this issue Jun 1, 2023 · 0 comments

Comments

@janithcmw
Copy link

Description

When trying out throttling with Redis based on the documentation[1] the following error was observed when Redis is expecting authentication.

ERROR - ThrottleWindowReplicator Could not replicate throttle data
redis.clients.jedis.exceptions.JedisDataException: Cannot use Jedis when in Multi. Please use Transaction or reset jedis state.
	at redis.clients.jedis.BinaryJedis.checkIsInMultiOrPipeline(BinaryJedis.java:1895) ~[org.apache.servicemix.bundles.jedis_3.3.0.1.jar:?]
	at redis.clients.jedis.Jedis.get(Jedis.java:183) ~[org.apache.servicemix.bundles.jedis_3.3.0.1.jar:?]
	at org.wso2.carbon.apimgt.gateway.RedisBaseDistributedCountManager.getTimestamp_aroundBody12(RedisBaseDistributedCountManager.java:204) ~[org.wso2.carbon.apimgt.gateway_9.28.116.jar:?]
	at org.wso2.carbon.apimgt.gateway.RedisBaseDistributedCountManager.getTimestamp(RedisBaseDistributedCountManager.java:1) ~[org.wso2.carbon.apimgt.gateway_9.28.116.jar:?]
	at org.apache.synapse.commons.throttle.core.SharedParamManager.getSharedTimestamp(SharedParamManager.java:172) ~[synapse-commons_4.0.0.wso2v20.jar:?]
	at org.apache.synapse.commons.throttle.core.ThrottleWindowReplicator$ReplicatorTask.run(ThrottleWindowReplicator.java:111) ~[synapse-commons_4.0.0.wso2v20.jar:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
	at java.lang.Thread.run(Thread.java:829) [?:?]

[1] https://apim.docs.wso2.com/en/latest/design/rate-limiting/advanced-topics/configuring-rate-limiting-api-gateway-cluster/#configuring-a-redis-cluster-with-api-manager

Steps to Reproduce

  1. Eneble auth in Redis server.

  2. According to the Redis documentation[1] it is required to pass 'requirepass' property to enable security for Redis.

  3. Then verify the authentication using the AUTH command in redis-cli.

  4. Add the following configurations to the APIM 'deployment.toml' file.

[apim.redis_config]
host = "localhost"
port = "6379"
user = "root"
password = "root"
  1. Invoke an API with uses subscription burst control. Then the above log can be seen based on the configured frequency for the property 'throttling.replication.frequency'

[1] https://redis.io/docs/management/security/acl/

Affected Component

APIM

Version

4.2.0

Environment Details (with versions)

N/A

Relevant Log Output

N/A

Related Issues

No response

Suggested Labels

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants