← Evaluations/EVAL-20260318-161503
code
Mar 18, 2026EVAL-20260318-161503

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
GPT-5.4
openrouter
9.97
WINNER SCORE
matrix avg: 8.22
results.json report.mdFull dataset (CSV) →
10×10 Judgment Matrix · 42 judgments
OPEN DATA
Judge ↓ / Respondent →MiniMax M2.7MiniMax M2.5MiniMax M2.1MiniMax M2MiniMax M1MiniMax-01Claude Sonnet 4.6GPT-5.4
MiniMax M2.79.4··10.08.810.010.0
MiniMax M2.59.3··9.48.69.810.0
MiniMax M2.19.8··10.07.810.010.0
MiniMax M29.89.0·10.08.310.010.0
MiniMax M18.39.0··8.310.010.0
MiniMax-0110.09.61.9·9.810.09.8
Claude Sonnet 4.69.69.0··9.68.610.0
GPT-5.47.46.7··8.87.88.7