openresty / openresty/lua-nginx-module

If the timer value in ngx.timer.at() is too high, callback triggers immediately

Open
#1,278 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11.8k
Forks
2.1k
Avg merge
6h 1m
Merged PRs (30d)
6

Description

  • The exact version of the related software, including but not limited to the OpenResty version (if any), the NGINX core version, the ngx_lua module version,
    and your operating system version.

nginx version: openresty/1.11.2.5
built by gcc 6.2.0 (GCC)
ngx_lua-0.10.10
Linux 4.13.2

  • A minimal and standalone test case that others can easily run on their side and
    reproduce the issue you are seeing.
http {
    server {
        listen 5309;
        location = / {
            content_by_lua_block {
                local function fn()
                    ngx.log(ngx.ERR, "Hello from callback")
                end
                ngx.timer.at(1e16, fn)
                return 200;
            }
        }
    }
}

Once I hit the endpoint, "Hello from callback" shows up immediately in the logs. If I lower the timer to 1e15, it doesn't.

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 standalone nginx configuration and the ngx.timer.at entry point, reproducing the contrast between delays of 1e15 and 1e16 on the reported OpenResty and ngx_lua versions. Trace how the timer delay is handled and define the expected behavior for an excessively large value; done means the callback no longer fires immediately, with a regression test covering the boundary.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, lua, nginx
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.