← Evaluations/EVAL-20260402-130102
code
Apr 02, 2026CODE-011

This distributed lock implementation has a subtle race condition that can cause two processes to hold the lock simultaneously. Find the bug and fix it. ```python import redis import time import uuid class DistributedLock: def __init__(self, redis_client, lock_name, timeout=10): self.redis = redis_client self.lock_name = f"lock:{lock_name}" self.timeout = timeout self.token = str(uuid.uuid4()) def acquire(self): while True: if self.redis.setnx(self.lock_name, self.token): self.redis.expire(self.lock_name, self.timeout) return True time.sleep(0.1) def release(self): if self.redis.get(self.lock_name) == self.token: self.redis.delete(self.lock_name) ``` Explain why this is dangerous in production and provide a correct implementation.

Winner
Claude Sonnet 4.6
openrouter
9.44
WINNER SCORE
matrix avg: 8.59
results.json report.mdFull dataset (CSV) →
10×10 Judgment Matrix · 84 judgments
OPEN DATA
Judge ↓ / Respondent →GPT-5.4Claude Opus 4.6Gemini 3.1 ProClaude Sonnet 4.6Grok 4.20DeepSeek V4GPT-OSS-120BGemini 3MiniMax M2.5MiMo-V2-Flash
GPT-5.48.41.68.89.06.07.58.66.88.6
Claude Opus 4.610.02.59.69.39.09.29.68.89.2
Gemini 3.1 Pro8.18.810.09.35.98.110.07.89.3
Claude Sonnet 4.69.89.84.38.88.29.08.89.08.8
Grok 4.209.09.05.79.08.88.78.68.88.6
DeepSeek V49.69.88.69.69.810.09.69.69.6
GPT-OSS-120B8.88.83.48.8·8.08.6·8.6
Gemini 310.010.08.110.0·9.89.610.010.0
MiniMax M2.510.09.42.59.88.87.88.68.88.4
MiMo-V2-Flash·9.38.89.39.2·8.8·8.6