FAILURE MAP
← Case archive

FA-7731 / Connection lifecycle / Open access

Pool idle selection chooses most recently used healthy socket · case 01

Pool idle selection chooses most recently used healthy socket.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The faulty implementation uses `max(sockets,key=lambda s:s[1],default=(None,))[0]` for the pool-idle-selection-chooses-most-recently-used-healthy-socket decision.

VERIFIED REPAIR

Apply the explicit pool-idle-selection-chooses-most-recently-used-healthy-socket contract, including the tested boundary and negative cases.

Unsuccessful approach: The attempted repair uses `min((s for s in sockets if s[2]),key=lambda s:s[1],default=(None,))[0]` and still violates a separate fixture.

Case contract

Bounded offline decision model: pool idle selection chooses most recently used healthy socket. Inputs are already validated protocol fields; the explicit fixtures define the supported policy, not a complete protocol implementation.

Why this case matters

This deterministic connection lifecycle model isolates the pool-idle-selection-chooses-most-recently-used-healthy-socket policy at a network component boundary.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(sockets):
    return max(sockets,key=lambda s:s[1],default=(None,))[0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve([('a', 1, True), ('b', 2, True), ('bad', 3, False)]), 'b')", "check('fixture 2', solve([]), None)", "check('fixture 3', solve([('bad', 3, False)]), None)", "check('fixture 4', solve([('a', 1, True)]), 'a')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 2NoneNonePassed
fixture 3badNoneFailed
fixture 4aaPassed
fixture 1badbFailed

SHA-256 / 47d37e172538801bfd3b73d6cbc889d371f8bb3695e8301bceebbf119caf7b68

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(sockets):
    return min((s for s in sockets if s[2]),key=lambda s:s[1],default=(None,))[0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve([('a', 1, True), ('b', 2, True), ('bad', 3, False)]), 'b')", "check('fixture 2', solve([]), None)", "check('fixture 3', solve([('bad', 3, False)]), None)", "check('fixture 4', solve([('a', 1, True)]), 'a')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 2NoneNonePassed
fixture 3NoneNonePassed
fixture 4aaPassed
fixture 1abFailed

SHA-256 / 030d4a07ca9ac75cab1161b534e77ccb73bea25d01a25dddf7e5c79fd0c0e839

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(sockets):
    return max((s for s in sockets if s[2]),key=lambda s:s[1],default=(None,))[0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve([('a', 1, True), ('b', 2, True), ('bad', 3, False)]), 'b')", "check('fixture 2', solve([]), None)", "check('fixture 3', solve([('bad', 3, False)]), None)", "check('fixture 4', solve([('a', 1, True)]), 'a')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 2NoneNonePassed
fixture 3NoneNonePassed
fixture 4aaPassed
fixture 1bbPassed

SHA-256 / b1374fd5fe8fd7ea3c39aa313b53adad69f90018653eb923bd5d52b9bcf9bbf6

Verification & scope

Bounded deterministic policy model over validated inputs; not a complete protocol stack or an interoperability claim. The five variants rotate the same explicit fixture set. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:38:14.819208+00:00.

Case digest / 8cbbe93b25d0de2666fc5522581bf9b77c7b1cce25dcccf8e489f619dbb2341c