← Evaluations/EVAL-20260315-053734
code
Mar 15, 2026EVAL-20260315-053734

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
Gemma 3 27B
openrouter
9.51
WINNER SCORE
matrix avg: 8.56
results.json report.mdFull dataset (CSV) →
10×10 Judgment Matrix · 76 judgments
OPEN DATA
Judge ↓ / Respondent →Qwen 3 32BKimi K2.5Devstral SmallGemma 3 27BLlama 4 ScoutPhi-4 14BGranite 4.0 MicroQwen 3 8BMistral Nemo 12BLlama 3.1 8B
Qwen 3 32B·7.010.010.07.56.39.04.65.5
Kimi K2.5··9.35.8···1.91.9
Devstral Small9.4·9.810.010.08.29.07.67.6
Gemma 3 27B9.8·9.89.89.89.69.89.28.4
Llama 4 Scout9.8·9.69.810.08.69.88.38.6
Phi-4 14B8.86.89.89.89.89.810.08.78.8
Granite 4.0 Micro8.88.3·8.68.88.88.88.88.4
Qwen 3 8B10.0·9.610.010.09.68.84.46.0
Mistral Nemo 12B8.6·8.29.28.18.6·8.67.8
Llama 3.1 8B9.6·9.19.09.49.69.19.69.2