tarantool / tarantool/queue

fifottl queue entries with an explicit ttl get stuck in an odd state

Open
#191 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Lua
Stars
244
Forks
56
PR merge metrics
No merged PRs in 30d

Description

when this syntax is used to put data in the buffer

queue.tube.test_buffer:put(data, {ttr=60, ttl=15768000000000000})

You end up with entries that have a ttl of 0 and a large next_event time

issue after the test fails the buffer has entries in a state where the ttl is 0, but next event is large [[select "task_id" from "test_buffer" where "ttl" = 0;]] the entries are not returned from take as they are expired, but they should not have expired

using docker image tarantool/tarantool:2.8.4
and a nodejs client

Place tarantool --version output here.
Tarantool 2.8.4-0-g47e6bd362
Target: Linux-x86_64-RelWithDebInfo
Build options: cmake . -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_BACKTRACE=ON
Compiler: /usr/bin/cc /usr/bin/c++
C_FLAGS: -fexceptions -funwind-tables -fno-omit-frame-pointer -fno-stack-protector -fno-common -fopenmp -msse2 -std=c11 -Wall -Wextra -Wno-strict-aliasing -Wno-char-subscripts -Wno-format-truncation -Wno-gnu-alignof-expression -fno-gnu89-inline -Wno-cast-function-type
CXX_FLAGS: -fexceptions -funwind-tables -fno-omit-frame-pointer -fno-stack-protector -fno-common -fopenmp -msse2 -std=c++11 -Wall -Wextra -Wno-strict-aliasing -Wno-char-subscripts -Wno-format-truncation -Wno-invalid-offsetof -Wno-gnu-alignof-expression -Wno-cast-function-type

Steps to reproduce
see the project at
https://github.com/mannnick24/tarantool-fifottl-explicit-ttl/blob/main/docker/Dockerfile
this code uses node tarantool connection to concurrently call queue.tube.test_buffer:take, queue.tube.test_buffer:put and queue.tube.test_buffer:ack

How to run:

npm i

build.sh (in docker)

npm run test

Actual behavior
after the test fails the buffer has entries in a state where the ttl is 0, but next event is large [[select "task_id" from "test_buffer" where "ttl" = 0;]] the entries are not returned from take as they are expired, but they should not have expired

e.g. box.execute([[select "task_id", "status", "created", "ttr", "ttl", "next_event" from "el_buffer" where "ttl" = 0 limit 20;]])

metadata:

name: task_id type: unsigned

name: status type: string

name: created type: unsigned

name: ttr type: unsigned

name: ttl type: unsigned

name: next_event type: unsigned rows:

[4, 'r', 1662662470225835, 60000000, 0, 18446744073709551615]

Expected behavior
the buffer would be empty

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction project and its docker/Dockerfile, then run npm i, build.sh in Docker, and npm run test. Inspect the concurrent queue.tube.test_buffer:take, put, and ack calls, especially the explicit ttl case. Done means entries are not left with ttl 0 and a large next_event, and the reproduction no longer leaves incorrectly expired tasks unavailable from take.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, lua, nodejs
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.