advancedMultithreading & Concurrency375 of 436
Why is Redis-based distributed locking tricky? What happens if a JVM crashes while holding a distributed lock?
Tests whether you know the lock needs a TTL so a crashed holder's lock expires instead of deadlocking everyone forever, and whether you're aware of the clock-drift/failover edge cases (the motivation behind algorithms like Redlock) that make naive SETNX locking unsafe at scale.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response