[🐛 Bug]: [rust] Selenium Manager can return a browser from the cache before it finishes copying
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 65/100
Direzione di ricerca
Read rust/src/lib.rs around download_browser (line 323) and the driver check (line 969), then inspect copy_folder_content in rust/src/files.rs (line 567). Reproduce with two Selenium Manager processes sharing a cache while Chrome is copied. Done means a process only receives the browser path after its files are fully available; the issue suggests atomic rename, a completion marker, or checking under the lock.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
When several Selenium Manager processes share a cache, one of them can get a browser path back while another process is still copying that browser into the cache. The browser then fails to start. With Chrome, chromedriver reports session not created: Chrome instance exited.
The cache lock added for #13511 and #13686 stops two processes from downloading at the same time. However, download_browser checks whether the browser binary exists before it takes the lock (rust/src/lib.rs:323). If the binary is there, it returns that path without waiting on the lock. The process doing the download holds the lock while it unzips into a temporary folder and then copies the files into the cache one at a time (copy_folder_content). The binary can be copied before the libraries and resources it needs. Any process that checks during that copy gets a path to an incomplete browser.
The driver has the same unlocked check (rust/src/lib.rs:969). The window there is smaller, since only a single file is copied.
This affects every binding, and any process that shares a cache folder: parallel test workers in one CI job, or several runners on one self-hosted machine.
Expected: a browser path is returned only once that browser is fully in the cache.
Possible fixes:
- Unzip into a temporary folder inside the cache and rename it into place once complete. Alternatively, write a marker file last and check for the marker instead of the binary.
- Check for the binary only after taking the lock. This is simpler, but every run then waits on the lock.
Reproducible Code
# Watches the cache while one process downloads Chrome for Testing.
# The browser binary appears long before the rest of the files.
SM=/path/to/selenium-manager
CACHE=$(mktemp -d)
"$SM" --browser chrome --browser-version 157 --force-browser-download \
--cache-path "$CACHE" --output json > /dev/null 2>&1 &
PID=$!
while kill -0 $PID 2>/dev/null; do
files=$(find "$CACHE/chrome" -type f 2>/dev/null | wc -l | tr -d ' ')
binary=$(find "$CACHE/chrome" -type f \( -path '*MacOS/Google Chrome for Testing' -o -name chrome \) 2>/dev/null | wc -l | tr -d ' ')
echo "files=$files binary=$binary"
sleep 0.05
done | uniq
# Running a second selenium-manager with the same arguments while the
# output shows binary=1 and an incomplete file count makes it log
# "chrome ... already exists at ..." and return the incomplete browser.
Debugging Logs
# macOS arm64, Selenium Manager from selenium-webdriver 4.53.0
files=0 binary=0
files=1 binary=0
files=37 binary=1
files=349 binary=1
At the files=37 binary=1 step, any other Selenium Manager process gets this browser back from the unlocked check, even though only 36 of its 349 files are in place (the other file is the lock).
- Lingua principale
- Java
- Stelle
- 34.6k
- Fork
- 8.7k
- Merge medio
- 1g 16h
- PR unite (30g)
- 107
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
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 SeleniumHQ/selenium
-
C-py I-defect
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
SeleniumHQ/selenium#18438 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
SeleniumHQ/selenium#18323 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
B-build C-py I-enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
SeleniumHQ/selenium#18435 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[🐛 Bug]: Bindings change the user's options when Selenium Manager supplies a browserForse già presa @Liz-Lian l’ha presa 2 giorni fa. ApertaC-dotnet C-java C-nodejs C-py C-rb I-defect
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
SeleniumHQ/selenium#18428 ·
I maintainer di solito rispondono entro 1 giorno
-
C-py D-chrome OS-windows
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
SeleniumHQ/selenium#18394 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di SeleniumHQ/selenium
Issue simili
-
area-integrations
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
? - Needs Triage bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
NVIDIA/cudf-spark-jni#5598 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
oracle/graalvm-reachability-metadata#12264 ·
I maintainer di solito rispondono entro 1 giorno
-
[source-facebook-pages] post stream never returns attachments.media_typeForse già presa @v-k-data l’ha presa oggi. Apertaarea/connectors needs-triage type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] AppSync: GetIntrospectionSchema wraps the schema in JSON instead of returning the raw SDL bodyAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
floci-io/floci#10107 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno