openresty / openresty/lua-nginx-module

Intermittently receiving API disabled in context

Open
#1,815 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

Hi,

Inside init_worker_by_lua_file. I am running an ngx.timer.at which spawns a ngx.thread.
Inside the spawned thread, I am calling my custom lua file using require function. If I create a timer with initial delay of 0 then I always get API disabled. Where as if i set an initial delay of 1 or 2 minutes then intermittently I am able to see the API disabled error at require function.

As per my understanding, the custom written lua code is not initialized so I am getting API disabled in context.

Is there any way to make sure the custom library is initialized before I call the code from my spawned thread?

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 by reviewing the init_worker_by_lua_file, ngx.timer.at, ngx.thread, and require execution contexts described in the report, then reproduce the zero-delay and delayed timer cases. Compare the observed API-disabled behavior with the module's documented context restrictions; done means establishing whether the sequence is supported and identifying the required initialization or a clear limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, nginx
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.