A query copies a shared binding's observer slot outside the lock its recorder holds (ThreadSanitizer: 16 warnings on two threads)
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 48/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- c
- Domínio
- backend-api-design, testing-qa
Direção de pesquisa
Start with vm_slot_query_view in src/vm.c and the observer record path in src/eigenscript.c, then inspect tests/test_tsan.sh and the instruction-count gate. Run the supplied two-thread program and its trajectory of g variant under make tsan; done means no ThreadSanitizer warning on the query or record paths, with the planted race still detectable. Document whether readers see a slot before or after a record and how growth protects storage held by readers.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
On phase2-numbers at 652b262a, a query of a numeric binding copies its observer slot without the lock that a recording thread holds while it writes the slot. With two OS threads sharing one binding, one assigning it and one reading report of, converged of or stable of it, ThreadSanitizer reports data races between the copy and the record.
g is 1
define reader(n) as:
local i is 0
local r is 0
loop while i < n:
r is [report of g, converged of g, stable of g]
i is i + 1
return r
th is spawn of [reader, 3000]
define writer(n) as:
local j is 0
loop while j < n:
g is j * 1.5
j is j + 1
return j
print of (writer of 3000)
print of (thread_join of th)
make tsan, run with setarch -R and TSAN_OPTIONS="halt_on_error=0 exitcode=0": 16 warnings on this program (30 with trajectory of g among the reads). The first:
WARNING: ThreadSanitizer: data race
Write of size 1 by main thread (mutexes: write M0):
#0 observer_slot_update_numeric_locked src/eigenscript.c:1229
#1 observer_slot_update_numeric_shared src/eigenscript.c:1269
#2 observer_slot_update_numeric src/eigenscript.c:1319
#3 observer_slot_update src/eigenscript.c:1327
#4 vm_run_ex src/vm.c:5869
Previous read by thread T1:
#0 vm_slot_query_view src/vm.c:459
The read is ObserverSlot q = *s in vm_slot_query_view: the whole slot copied outside the fold lock, then read. The write is the record under that lock. The copy can therefore hold a slot caught between two of the record's writes (a count that is ahead of the ring it counts, or the reverse). That is what the report shows. Whether a reader can also index storage that the recorder has since replaced is NOT shown here (in a live program the storage is made once, when the binding gets its first number, and only a tape's configuration record regrows it); the repair says whether it can.
The tree's own planted race (EIGS_TSAN_OBSERVER_FOLD_OUTSIDE_HOLD=1) raises the count on the same program from 16 to 47, so the hosted thread-sanitizer slice would see a race of this kind if it ran such a program; it runs a fixed slice (tests/test_tsan.sh) that has no reader of a shared numeric binding beside a writer.
Found by an independent review of a bar for another change to the same slot; that change does not touch this.
Done when
- The program above (and its
trajectory of gform) runs undermake tsanwith no warning whose stack holdsvm_slot_query_viewor the record path, on a head where the planted race still raises warnings (shown first). - The repair says what a reader may see: the slot as it was before a record or after it, never between; and that a growth cannot free what a reader holds. If the copy stays, it is taken under the lock; if a query then pays for the lock on an unshared binding, the cost is measured on the rows of the instruction-count gate.
-
tests/test_tsan.shgains a program of this shape, so that the hosted slice sees the next one.
— Claude DevBox
- Linguagem predominante
- C
- Estrelas
- 3
- Forks
- 7
- Merge médio
- 3h 28min
- PRs com merge (30d)
- 270
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Inclui um Dockerfile ou arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de InauguralSystems/EigenScript
-
area:gates kind:gate-defect
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
InauguralSystems/EigenScript#2476 ·
Mantenedores costumam responder em até 1 dia
-
area:gates needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
InauguralSystems/EigenScript#2462 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
The hosted-RNG check refuses a clean tree that has a tracked file with a double quote in its nameAbertaarea:gates kind:gate-defect needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
InauguralSystems/EigenScript#2461 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
area:gates kind:gate-defect needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
InauguralSystems/EigenScript#2458 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
`http_post`: `headers` text with something after its JSON value now means no headers, without a wordAbertaarea:http kind:silent-wrong
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
InauguralSystems/EigenScript#2394 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de InauguralSystems/EigenScript
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
flipperdevices/flipperzero-firmware#4520 ·
Mantenedores costumam responder em até 1 dia
-
area/build-framework kind/enhancement priority/low
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
yugabyte/yugabyte-db#38826 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
meshcore-dev/MeshCore#3891 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
vlang/v#32675 · 1 comentário ·
Mantenedores costumam responder em até 1 dia