*ttl drivers: TTL branch dereferences delete() result without a nil check, killing the fiber
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 76/100
Línea de trabajo
Start with the TTL branches in queue/abstract/driver/fifottl.lua and utubettl.lua at the referenced lines, then read the delete implementation around fifottl.lua#L334-L342 and compare the handling in subqueuettl from #259. Verify the chosen fix for a task deleted between selection and deletion, including vinyl and MVCC cases, and ensure TTL processing continues instead of the fiber dying.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Environment: queue master (07fd732), also 1.5.0. Found by code review while porting the subqueuettl driver (#259), which copies the same loop.
Summary
In the TTL branch of the fiber iteration the result of delete() is dereferenced unconditionally:
-- fifottl.lua#L113-L117, same in utubettl.lua#L243 and #L521
task = self.space.index.watch:min{ task_state }
if task ~= nil and task[i_status] == task_state then
if now >= task[i_next_event] then
task = self:delete(task[i_id]):transform(2, 1, state.DONE)
self:on_task_change(task, 'ttl')
but method.delete() returns nil when the task is already gone (fifottl.lua#L334-L342), so a task that disappears between min() and delete() produces attempt to index a nil value, the fiber dies, and TTL processing stops for good (see #263). The delayed and TTR branches tolerate a nil from update() because abstract.lua ignores on_task_change(nil, ...); only the TTL branch does not.
When it is reachable
- memtx without MVCC: not reachable, there is no yield between
min()andget(); I could not reproduce it there. - vinyl (
fifottlsupportsengine = 'vinyl'): reads may yield on disk I/O, so a concurrentack()/delete()of the same expired task betweenmin()anddelete()hits it. - memtx with MVCC:
delete()may also raiseTransaction has been aborted by conflictwith a concurrent write on the same task, which kills the fiber the same way.
Suggested fix
Either guard the result:
task = self:delete(task[i_id])
if task ~= nil then
self:on_task_change(task, 'ttl')
end
or do min() + delete() inside one box.atomic() so the selection and the delete see the same state. The subqueuettl driver in #259 does the former for the fork we run.
- Lenguaje dominante
- Lua
- Estrellas
- 244
- Forks
- 56
- Merge medio
- 6 d 8 h
- PR fusionados (30 d)
- 1
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de tarantool/queue
-
tube:grant() is not documented Abiertodocumentation good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
-
1sp bug teamE
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Todos los issues de tarantool/queue
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
LandSandBoat/server#11579 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
ArchiveTeam/sinavideo-grab#7 · 3 reacciones ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
mailcow/mailcow-dockerized#7480 ·
-
Mapper: a failed area image export crashes Mudlet if the profile closed while it was running Abiertomapper bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
documentation feature-request mini.completion
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100