Retry: sleep_for_retry uses max(wait, delay_max) — inflates small Retry-After to delay_max (60s floor)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
Direzione di ricerca
Leggi src/databricks/sql/auth/retry.py, iniziando da DatabricksRetryPolicy.sleep_for_retry e dal clamp adiacente di get_backoff_time. Riproduci il piccolo caso Retry-After ed esamina tests/test_error_recovery.py, in particolare lo scenario progressivo di Retry-After. Il lavoro è completo quando i valori di Retry-After sono limitati invece di essere aumentati fino a delay_max e i percorsi di retry interessati non aspettano più il limite inferiore di 60 secondi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
DatabricksRetryPolicy.sleep_for_retry applies delay_max as a floor instead of a ceiling, so a small server Retry-After (e.g. 2) is inflated to the full delay_max (default 60s) on every retry. This makes retryable errors that advertise a short Retry-After sleep far longer than the server requested.
Location
src/databricks/sql/auth/retry.py, in sleep_for_retry:
retry_after = self.get_retry_after(response)
if retry_after:
proposed_wait = retry_after
else:
proposed_wait = self.get_backoff_time()
proposed_wait = max(proposed_wait, self.delay_max) # <-- BUG: floor, not ceiling
...
time.sleep(proposed_wait)
max(proposed_wait, self.delay_max) guarantees the sleep is at least delay_max. With the default _retry_delay_max = 60, a server response of Retry-After: 2 results in max(2, 60) = 60s.
Why it's a bug
The sibling method get_backoff_time in the same file does the opposite (and correct) clamp, with a docstring that states the intent:
# get_backoff_time():
# "Never returns a value larger than self.delay_max"
proposed_backoff = min(proposed_backoff, self.delay_max)
So delay_max is intended as a ceiling on the wait. sleep_for_retry inverts it. The fix is to cap (not floor) the proposed wait — min(proposed_wait, self.delay_max) — or to not clamp an explicit server Retry-After upward at all.
Impact / repro
A server that returns 503 with a small Retry-After (say 2s, then 4s, then success) is honored as 60s, then 60s — 120s total instead of the intended ~6s.
Observed in the driver-test conformance suite (ERRORRECOV-001, "HTTP 503 with progressive Retry-After"): the request-executing test blocked in retry.py sleep_for_retry -> time.sleep(60) twice and hit the 120s pytest-timeout. faulthandler stack (SEA backend):
tests/test_error_recovery.py:70 cur.execute(SIMPLE_QUERY)
-> databricks/sql/backend/sea/backend.py execute_command
-> .../sea/utils/http_client.py _make_request
-> urllib3 connectionpool.urlopen -> retries.sleep(response)
-> databricks/sql/auth/retry.py:~301 sleep_for_retry -> time.sleep(proposed_wait)
Backend-agnostic: it's in the shared DatabricksRetryPolicy, so both the SEA and Thrift HTTP paths are affected (the kernel path uses a different retry mechanism and is unaffected).
Suggested fix
proposed_wait = min(proposed_wait, self.delay_max)
(and confirm delay_max is the intended upper bound on an honored Retry-After, matching get_backoff_time).
- Lingua principale
- Python
- Stelle
- 236
- Fork
- 162
- Merge medio
- 13h 13m
- PR unite (30g)
- 23
Preparare l'ambiente
- 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 databricks/databricks-sql-python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
databricks/databricks-sql-python#1034 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
databricks/databricks-sql-python#1012 ·
I maintainer di solito rispondono entro 1 giorno
-
Token federation: `_exchange_token` raises KeyError('access_token') on error responses, discarding the real failure reasonForse già presa @TangoEnSkai l’ha presa 81 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
databricks/databricks-sql-python#904 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
databricks/databricks-sql-python#865 ·
I maintainer di solito rispondono entro 1 giorno
-
Cursor.close() leaks server-side handle for async commands that were never fetchedForse già presa @nanookclaw l’ha presa 176 giorni fa. Apertabug engineer-bot
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
databricks/databricks-sql-python#791 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di databricks/databricks-sql-python
Issue simili
-
namespace
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
EclipseFdn/open-vsx.org#15604 ·
I maintainer di solito rispondono entro 1 giorno
-
app: scripts severity: low status: backlog type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
netbox-community/netbox-scripts#164 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 5 giorni
-
Public function to read participants.tsvForse già presa @bruAristimunha l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
huggingface/tau#799 ·
I maintainer di solito rispondono entro 2 giorni