Skip to content

Commit e355387

Browse files
PersDepTotktonada
authored andcommitted
fix fifottl_fiber_iteration error handling
fifottl_fiber pcalls fifottl_fiber_iteration and then handles result. Returned error code comparison with box.error.READONLY was not done properly. Now it is fixed. Corresponding test case: buried task in dropped queue scenario is added. Closes #96
1 parent 445da1d commit e355387

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

queue/abstract/driver/fifottl.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ local function fifottl_fiber(self)
164164
while true do
165165
if not box.cfg.read_only then
166166
local stat, err = pcall(fifottl_fiber_iteration, self, processed)
167-
if not stat and not err.code == box.error.READONLY then
167+
if not stat and not (err.code == box.error.READONLY) then
168168
log.error("error catched: %s", tostring(err))
169169
log.error("exiting fiber '%s'", fiber.name())
170170
return 1

t/020-fifottl.t

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
local fiber = require('fiber')
33

44
local test = require('tap').test()
5-
test:plan(14)
5+
test:plan(15)
66

77
local queue = require('queue')
88
local state = require('queue.abstract.state')
@@ -245,6 +245,23 @@ test:test('ttl after delay test', function(test)
245245
test:is(task.ttr, TTR * 1000000, 'check TTR after release')
246246
end)
247247

248+
-- gh-96: infinite loop after dropping a tube with a burried task
249+
test:test('buried task in a dropped queue', function(test)
250+
test:plan(1)
251+
252+
local TASK_ID = 1
253+
local tube = queue.create_tube('test_drop_with_burried', 'fifottl',
254+
{ttr = 0.1, if_not_exist = true})
255+
256+
tube:put({foo = 'bar'})
257+
local task = tube:take(0)
258+
tube:bury(task[TASK_ID])
259+
260+
tube:drop()
261+
fiber.sleep(0.2)
262+
test:ok(true, 'queue does not hang')
263+
end)
264+
248265

249266
tnt.finish()
250267
os.exit(test:check() == true and 0 or -1)

0 commit comments

Comments
 (0)