fifottl/limfifottl: stop() blocks forever while RW, drop() leaks the TTL fiber
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 55/100
Piste de recherche
Start in queue/abstract/driver/fifottl.lua, especially the TTL loop and stop-channel setup referenced at lines 171-177 and 200; compare its lifecycle with utubettl. Reproduce the RW stop and dropped-tube cases from the issue, then verify that stop returns, fibers terminate, and dropping a tube leaves no TTL fiber using the supplied checks.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Environment: queue master (07fd732), Tarantool 3.8.0 (also the same code in 1.5.0). memtx.
Summary
fifottl (and therefore limfifottl) creates its stop channel as an unbuffered fiber.channel() (fifottl.lua#L200), but the TTL fiber only reads it in the box.info.ro == true branch (fifottl.lua#L171-L177). So:
tube.raw:stop()called while the instance is RW blocks the caller forever.fifottlhas nomethod.drop, sotube:drop()never callsstop()at all: the space is dropped and the TTL fiber leaks, one per dropped tube. After the instance becomes RO the leaked fibers sit in thesync_chan:get(0.1)poll loop forever.utubettlusesfiber.channel(1)so itsstop()returns, but the fiber keeps running in RW;utubettl'sdrop()then makes it crash on the dropped space (attempt to index field 'watch' (a nil value)).
Repro
local fiber = require('fiber')
box.cfg{}
local queue = require('queue')
-- 1. stop() blocks while RW
local tube = queue.create_tube('t', 'fifottl')
local done = false
fiber.create(function() tube.raw:stop(); done = true end)
fiber.sleep(1)
print('fifottl raw:stop() returned within 1s:', done) -- false (utubettl: true)
-- 2. drop() leaks the fiber
local function ttl_fibers()
local n = 0
for _, f in pairs(fiber.info()) do if f.name == 'fifottl' then n = n + 1 end end
return n
end
local before = ttl_fibers()
for i = 1, 3 do queue.create_tube('leak_' .. i, 'fifottl'):drop() end
fiber.sleep(0.5)
print('fifottl fibers leaked by 3 drops:', ttl_fibers() - before) -- 3
Output on master:
fifottl raw:stop() returned within 1s: false
fifottl fibers leaked by 3 drops: 3
Expected
stop() returns in both RW and RO mode and the fiber actually terminates; drop() stops the fiber before dropping the space (as utubettl tries to do), and does not leave the fiber running against a dropped space.
Suggested fix
Check a stop flag (or the channel with a zero timeout) in the RW branch of the loop as well, make stop() wait for the fiber to finish before clearing self.fiber, and add method.drop to fifottl that calls stop() first. fifottl should also use a buffered channel like utubettl so stop() cannot block the state machine fiber.
- Langage dominant
- Lua
- Étoiles
- 243
- Forks
- 56
- Merge moyen
- 6 j 8 h
- PR mergées (30 j)
- 1
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de tarantool/queue
-
tube:grant() is not documentedOuvertedocumentation good first issue
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
-
*ttl drivers: TTL branch dereferences delete() result without a nil check, killing the fiberPeut-être pris @maksimuimin l’a pris il y a 19 jours. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 76/100
-
*ttl drivers: a dead TTL fiber cannot be restarted and wedges the queue in ENDING on the next RO switchPeut-être pris @maksimuimin l’a pris il y a 19 jours. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
-
1sp bug teamE
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
-
bug
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
Toutes les issues de tarantool/queue
Issues similaires
-
enhancement good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 91/100
-
bug ready ticket
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Domktorymysli/vclu#5 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 3 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
portlandtn/VimConfigs#2 ·