Scrivio Interview library
DebuggingFoundations6 min read · updated 13 November 2026

A Spring Boot application moved from a self-managed Redis to a managed Redis-compatible service. It now fails at startup with 'ERR unknown command CONFIG' coming from Spring Session, and an internal admin page that lists keys times out.

Explain both failures and how to fix them.

Managed Redis-compatible services disable or rename administrative commands such as CONFIG and KEYS. Spring Session's indexed repository runs CONFIG SET notify-keyspace-events at startup to receive expiry events, so it fails; we turn that off with spring.session.redis.configure-action=none or a ConfigureRedisAction.NO_OP bean and set notify-keyspace-events in the provider's parameter settings, or switch to the default non-indexed repository if we do not need session events. The admin page almost certainly uses KEYS, which blocks a large instance; we rewrite it with SCAN and paging or remove it.

Why this question is asked

Moving to a managed Redis service usually goes smoothly until it meets code that assumed it owned the server. Both failures in this scenario come from that assumption, and interviewers use it to see whether we know what managed services restrict and what Spring Session does behind our back. In this answer, we will recap what managed services change, explain why Spring Session calls CONFIG and how to fix it, explain the admin page timeout and its fix, and finish with the check that should happen before any migration.

1A Quick Recap: What Managed Services Restrict

On a self-managed Redis, the application can run any command, including administrative ones. A managed service runs the server for us and protects its own operation, so it typically blocks or renames commands that change server configuration or can hurt the instance: CONFIG, sometimes KEYS, DEBUG, SHUTDOWN, SAVE and similar. Settings that we used to change with CONFIG SET are instead changed through the provider's parameter groups or console, and apply to the whole instance.

So the error ERR unknown command CONFIG does not mean the service is broken. It means some code is trying to configure a server it does not own.

2Why Spring Session Calls CONFIG at Startup

Spring Session offers two Redis repositories. The default RedisSessionRepository stores each session as a hash with a TTL and does not care how it expires. The indexed RedisIndexedSessionRepository adds lookup by principal name and publishes session created, deleted and expired events. To publish expired events it needs Redis keyspace notifications, messages Redis sends when keys expire, and those are off by default. So at startup the indexed repository runs CONFIG SET notify-keyspace-events with the flags it needs. On the managed service that command does not exist, and startup fails.

Step throughStartup with the indexed repository
Spring Boot appSpring SessionManaged Redis
create indexed session repository
CONFIG SET notify-keyspace-events Egx
ERR unknown command CONFIG
startup fails

4 messages in order. Play them, or step through them one at a time.

The repository tries to configure the server, which the managed service does not allow.

3Fixing the Startup Failure

There are two good fixes, depending on whether we need what the indexed repository provides. If we do need session events or lookups by principal, we keep the indexed repository, stop it from calling CONFIG, and set the notification flags ourselves in the provider's parameter settings.

Java
# application.properties (Spring Boot 3; check the property name in Boot 4)
spring.session.redis.repository-type=indexed
spring.session.redis.configure-action=none
// or, in Java configuration
@Bean
ConfigureRedisAction configureRedisAction() {
return ConfigureRedisAction.NO_OP; // Spring Session no longer runs CONFIG
}
# provider parameter group
notify-keyspace-events = Egx # E: keyevent channel, g: generic, x: expired

Notice that turning off the configure action alone is not enough. Without the notification flags set in the provider, startup succeeds but expired events never arrive, so listeners never fire and the principal index keeps references to dead sessions. The flags must be set on the server one way or the other.

If the application needs neither session events nor finding all sessions of a user, the simpler fix is to use the default, non-indexed repository. It stores one hash per session with a TTL, needs no keyspace notifications and never calls CONFIG. Many applications enabled the indexed one only because an older tutorial did.

4Why the Admin Page Times Out

An internal page that lists keys is almost always built on KEYS pattern, such as KEYS session:*. KEYS walks the whole keyspace in one command, and Redis runs commands on a single main thread, so on an instance with 20 million keys it can block every other client for seconds. Some managed services restrict it for exactly that reason; on others it runs and simply takes long enough for the page's request to time out, while also stalling production traffic.

The fix is SCAN, which walks the keyspace in small steps using a cursor. Each call returns a cursor and a batch of keys, and the page can show one batch at a time with a 'next' link that carries the cursor.

Java
ScanOptions options = ScanOptions.scanOptions().match("session:*").count(500).build();
try (Cursor<String> cursor = redisTemplate.scan(options)) {
List<String> page = new ArrayList<>();
while (cursor.hasNext() && page.size() < 100) {
page.add(cursor.next()); // up to 100 keys for this page
}
} // never blocks Redis for long

COUNT is a hint for how much work each SCAN step does, not an exact number of results. If nobody really needs the page, removing it is a perfectly good fix too.

5The Check That Prevents Both

Both failures were predictable. Before migrating, run INFO commandstats on the old instance; it lists every command that has been executed since the last restart with call counts, so it shows that cmdstat_config and cmdstat_keys are in use. Compare that list with the provider's documented restricted commands, and fix the code before the move instead of during the incident.

6Follow-up questions

Which other behaviours commonly differ on managed services?

Several: settings change through parameter groups rather than CONFIG SET, and some cannot be changed at all; persistence and backup schedules are the provider's; maintenance windows and automatic failovers happen on their schedule; TLS and AUTH or IAM-based authentication are often required; Lua scripts may be blocked from certain commands; modules may be unavailable; cluster mode endpoints and topology refresh behave differently; and the engine version can trail open source. Each one should be checked against how the application uses Redis.

Why does the indexed repository need expired events at all?

Redis removes expired keys silently. To publish a SessionExpiredEvent and to clean the principal index, Spring Session has to learn when a session key expires, and keyspace notifications are how Redis announces that. The default repository simply lets the key expire and does nothing else.

Is SCAN guaranteed to return each key exactly once?

No. SCAN guarantees that keys present for the whole scan are returned at least once, but a key may be returned more than once if the table is resized during the scan, so the page should tolerate duplicates.

7Conclusion

In this answer, we saw that managed services block administrative commands such as CONFIG and sometimes KEYS. Spring Session's indexed repository calls CONFIG SET notify-keyspace-events at startup, so we disable that with configure-action=none or ConfigureRedisAction.NO_OP and set the flags in the provider, or use the default non-indexed repository when we need no events. The admin page used KEYS, which blocks the server, so we rewrite it with SCAN and paging or remove it, and we use INFO commandstats before any migration to find such commands early.

What to say in the interviewAbout 80 seconds aloud

Open with

Both failures come from code that assumes it can administer the server. Managed services usually disable or rename commands like CONFIG, and settings change through the provider's parameter groups instead.

Then, if they want more

Spring Session's indexed repository runs CONFIG SET notify-keyspace-events at startup, because it needs expired-key notifications to publish session expired events and clean its principal index. On the managed service that command is unknown, so startup fails.

If we need those events, I would keep the indexed repository, set spring.session.redis.configure-action to none in Boot 3, or register a ConfigureRedisAction.NO_OP bean, and set notify-keyspace-events to something like Egx in the provider's settings, because without the flags the events silently stop.

If we need neither events nor lookup by principal, I would just use the default repository, which needs no notifications. The admin page almost certainly runs KEYS with a pattern, which walks the whole keyspace on Redis's single thread and blocks everyone, and may be restricted too.

I would rewrite it with SCAN and a cursor so each page does a small amount of work, or remove it. And next time I would run INFO commandstats on the old instance before migrating and compare it with the provider's restrictions.

About this answer

Last updated
13 November 2026
Versions it names
Spring Boot 3
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Redis documentation
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Explain both failures and how to fix them.": https://scrivio-interview-library.netlify.app/databases/redis-internals/2f4732bc70/