tarantool / queue

Create task queues, add and take jobs, monitor failed tasks
Other
237 stars 52 forks source link

error in tube_release_all_tasks() #121

Closed iskandarov-egor closed 4 years ago

iskandarov-egor commented 4 years ago

a question about the following function from abstract.lua:

local function tube_release_all_tasks(tube)
    local prefix = ('queue: [tube "%s"] '):format(tube.name)

    -- We lean on stable iterators in this function.
    -- https://github.com/tarantool/tarantool/issues/1796
    if not qc.check_version({1, 7, 5}) then
        log.error(prefix .. 'no stable iterator support: skip task releasing')
        log.error(prefix .. 'some tasks may stuck in taken state perpetually')
        log.error(prefix .. 'update tarantool to >= 1.7.5 or take the risk')
    end

    log.info(prefix .. 'releasing all taken task (may take a while)')
    local released = 0
    for _, task in tube.raw:tasks_by_state(state.TAKEN) do
        tube.raw:release(task[1])
        released = released + 1
    end
    log.info(prefix .. ('released %d tasks'):format(released))
end

this line tube.raw:release(task[1]) leads to an error: queue/abstract/driver/fifottl.lua:306: attempt to index local 'opts' (a nil value) because the call to release() is missing the opts argument.

also, it seems that the version check branch is missing a return statement.

SWSAmor commented 4 years ago

Maybe I got the same?

2020-05-15 10:04:47.958 [30097] main/102/tarantool-afr_tbequeue I> queue: [tube "tbettl"] releasing all taken task (may take a while)
2020-05-15 10:04:47.958 [30097] main/102/tarantool-afr_tbequeue tarantoolctl:551 E> Start failed: /usr/share/tarantool/queue/abstract/driver/fifottl.lua:306: attempt to index local 'opts' (
a nil value)
LeonidVas commented 4 years ago

@iskandarov-egor Hi! Thank you for the task. This is a very annoying mistake. I sent a PR.

LeonidVas commented 4 years ago

Maybe I got the same?

2020-05-15 10:04:47.958 [30097] main/102/tarantool-afr_tbequeue I> queue: [tube "tbettl"] releasing all taken task (may take a while)
2020-05-15 10:04:47.958 [30097] main/102/tarantool-afr_tbequeue tarantoolctl:551 E> Start failed: /usr/share/tarantool/queue/abstract/driver/fifottl.lua:306: attempt to index local 'opts' (
a nil value)

Yep.