AWS driver: initDB fails with MySQL 1205 while a running instance holds coordination-row locks across S3/witness I/O
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Start in storage/aws/aws.go at mySQLSequencer.initDB, around L1018 and L1040–1060, then trace publishCheckpoint and consumeEntries where FOR UPDATE spans f(...). Reproduce with two instances and delayed S3 or witness I/O; done means a second NewAppender no longer times out with MySQL 1205 while the first instance is active.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
With the AWS storage driver, a new process can fail to start while another instance of the same log is running, whenever that instance's S3 or witness I/O is slow. The new process's initDB blocks on coordination-table row locks that the running instance holds FOR UPDATE across network I/O. After InnoDB's lock wait (innodb_lock_wait_timeout, 50s by default), NewAppender fails with:
failed to init appender lifecycle: failed to create MySQL sequencer: failed to initDB: Error 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
Observed on v1.0.3. The relevant code is unchanged on v1.0.4 and on main.
Mechanism (storage/aws/aws.go)
At every startup, mySQLSequencer.initDB does two things (main, around L1018 and L1040–1060):
ALTER TABLE PubCoord ADD COLUMN size ..., expectingER_DUP_FIELDNAME;INSERT IGNORE INTOeach coordination table (Tessera,SeqCoord,IntCoord,PubCoord,GCCoord).
The INSERT IGNORE on an existing row takes a lock on that row, and the ALTER TABLE needs a metadata lock on PubCoord.
Running instances hold those rows FOR UPDATE while calling out:
publishCheckpointtakesSELECT publishedAt, size FROM PubCoord WHERE id = ? FOR UPDATE, then runsf(ctx, fromSeq, rootHash)before commit. That call builds, signs and witnesses the checkpoint and writes it to object storage.consumeEntriestakesSELECT seq, rootHash FROM IntCoord WHERE id = ? FOR UPDATE(plusSeq ... FOR UPDATE), then runsf(ctx, fromSeq, entries), which integrates and writes tiles and bundles to object storage, before commit.
So any stall in that I/O extends the lock hold, and a starting instance's initDB waits on it. In our case, S3 requests were being rejected with RequestTimeTooSkewed for about 15 minutes. Every new instance started during that window failed with 1205 and crash-looped until the I/O recovered.
Repro sketch
- Run one instance of a log on the AWS driver, with a steady trickle of
Adds so that integration and publication run. - Make object-storage writes slow, for example by injecting delay into the S3 client or at the network. The goal is for the
f(...)insideconsumeEntries/publishCheckpointto take longer thaninnodb_lock_wait_timeout. - Start a second instance against the same DB.
NewAppenderreturns the 1205 error above after about 50s.
Suggestions (either would fix it for us)
- Make
initDBlock-free when the schema already exists. Checkinformation_schema.COLUMNSbefore theALTER TABLE. Replace the unconditionalINSERT IGNOREs with a read (SELECT 1 ... WHERE id = 0, which needs no row lock under InnoDB consistent reads), and insert only when the row is missing. Then a started instance never contends with a running one. - Or release the coordination row locks before the network I/O, for example with an optimistic compare-and-set on the row after
f()completes, so the lock span is bounded by DB latency rather than object-storage or witness latency. That is a bigger change, but it would also bound contention between concurrent running instances.
We're working around it downstream by retrying NewAppender on 1205 with a short backoff. That only helps if the lock clears within the caller's startup budget. Happy to test a fix.
- Lingua principale
- Go
- Stelle
- 262
- Fork
- 64
- Merge medio
- 1g 6h
- PR unite (30g)
- 20
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun 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 transparency-dev/tessera
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
transparency-dev/tessera#1286 ·
I maintainer di solito rispondono entro 1 giorno
-
TestPosixMirrorIntegration fails on macOS: its burst of connections overflows the listen queueForse già presa @grempe l’ha presa 31 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
transparency-dev/tessera#1253 ·
I maintainer di solito rispondono entro 1 giorno
-
Fix tlog-mirror log origin length prefixForse già presa @phbnf l’ha presa 32 giorni fa. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
transparency-dev/tessera#1233 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
AWS: adds fail while object-storage writes are slow (integration's gap lock on Seq)Forse già presa @grempe l’ha presa 30 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
transparency-dev/tessera#1256 ·
I maintainer di solito rispondono entro 1 giorno
-
AWS: MySQL pools are never closed, so reopening a log in one process leaks goroutines and connectionsForse già presa @grempe l’ha presa 13 giorni fa. Aperta
Difficoltà 4/5 1-2 giorni Idoneità per principianti 48/100
transparency-dev/tessera#1251 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di transparency-dev/tessera
Issue simili
-
go good first issue test
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 2 giorni
-
[UI] Guard webApis against undefined window in SSR environmentsForse già presa @madhavzanwar l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
kind/enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
automated-analysis code-quality refactoring
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
github/gh-aw-mcpg#17105 ·
I maintainer di solito rispondono entro 1 giorno