Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

fifottl/limfifottl: stop() blocks forever while RW, drop() leaks the TTL fiber

オープン
#262 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
lua
領域
backend, databases

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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:

  1. tube.raw:stop() called while the instance is RW blocks the caller forever.
  2. fifottl has no method.drop, so tube:drop() never calls stop() 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 the sync_chan:get(0.1) poll loop forever.
  3. utubettl uses fiber.channel(1) so its stop() returns, but the fiber keeps running in RW; utubettl's drop() 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.

主要言語
Lua
スター
244
フォーク
56
平均マージ
6日 8時間
マージ済み PR(30日)
1

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

tarantool/queue のほかの issue

tarantool/queue の issue をすべて見る

似ている issue

Lua の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。