openresty / openresty/lua-nginx-module

Feature Request: ability to intentionally fail nginx loading by lua code

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

It would be useful to fail configuration loading from lua code, like in init_by_lua.

For example, we are building a system based on OpenResty, which has its own configuration, loaded when OpenResty starts. We load configuration in init_bu_lua so we can take advantages like COW, and rely on -s reload to reload new configuration for the system.

We use error() to fail loading when configuration is malformed, which terminates loading process and stop OpenResty from start.

The solution above has two problem: It prints traceback which mess up the error log, and it won't report any problem when -s reload. We didn't find a way to tell nginx that it fails to configurate, like any directive reciving bad arguments.

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 tracing the init_by_lua configuration-loading path and how nginx handles -s reload. The requested behavior is an intentional configuration failure from Lua without a traceback, with the failure reported during reload as it is for invalid directive arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, lua, nginx
Domain
backend, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.