Test isolation: ports are reserved per process, so parallel ctest jobs can be handed the same port
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Read tests/apps/isolate.py, especially freePort(), _pickPort() and _portFree(), then trace how the selected port reaches the Apache or broker startup. Check how ctest -j launches the apps_* tests and whether the service can retain a reserved socket. Done means concurrent tests cannot claim the same port and startup failures identify the service and port.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
tests/apps/isolate.py hands out ports with a process-local reservation set, so two
concurrent ctest jobs can be given the same port.
Mechanism. freePort() (tests/apps/isolate.py:154-163) binds a socket to
("127.0.0.1", 0), reads the port the OS offered, closes the socket, and then
only checks the number against _handedOut, a set that lives in the current Python
process:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.bind(("127.0.0.1", 0))
port = sock.getsockname()[1]
if port not in _handedOut:
_handedOut.add(port)
return port
Between the close and the moment the per-user Apache or the broker actually listens,
the port is unowned. Each apps_* ctest test is its own process with its own empty
_handedOut, so under ctest -j two tests can be offered the same number by the OS
and both proceed. _pickPort() (isolate.py:172-186) probes with _portFree() only
for a port given explicitly in the environment; the port that freePort() returns is
not probed again before the service is started.
Consequence. Not a clean "address already in use". The loser is the service that
starts second: the data server early-exits because something is already listening and
the test then talks to the other test's document root, or the broker fails to come up
and the app under test reports a messaging failure. The log shows an assertion failure
in the application, with no line naming a port, which is exactly the class of false
failure isolate.py's own module docstring (isolate.py:1-12) says it exists to
prevent -- it prevents overlap with a developer's live session, not overlap between
two tests of the same run.
Suggested fix: hold the bound socket open until the service has been handed the port
(bind with SO_REUSEADDR off and pass the fd or close it immediately before exec), or
re-probe with _portFree() and retry when the service fails to bind, and have the
failure message name the port and the service.
Not reproduced: this is read from the code. No run has been traced to a port
collision; under ctest -j the symptom would be an intermittent application-level
failure rather than anything that names a port, so an occurrence would not currently
be recognisable from the log.
- Lingua principale
- C
- Stelle
- 10
- Fork
- 8
- Merge medio
- 6h 32m
- PR unite (30g)
- 1
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di FriendsofECCE/ECCE
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
FriendsofECCE/ECCE#1358 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
FriendsofECCE/ECCE#1353 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
FriendsofECCE/ECCE#1348 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
FriendsofECCE/ECCE#1347 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
FriendsofECCE/ECCE#1345 ·
Tutte le issue di FriendsofECCE/ECCE
Issue simili
-
Installation fails from source: missing libintl.h on macOS, undeclared R_typeToChar() on R 4.6Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
vincentarelbundock/xtx#11 ·
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
compiler-explorer/compiler-explorer#9738 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 3 giorni
-
[Android Auto] MU1017 (MHI2Q_JP_AUG22_P1017) cluster map works with a pinned profile — values insideAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
kamgurgul/mib2q-carplay#74 ·