Add fault-injection CI workflow and OOM-guard test for NGX_NTLM_TEST_CLEANUP_NULL#3
Draft
Add fault-injection CI workflow and OOM-guard test for NGX_NTLM_TEST_CLEANUP_NULL#3
Conversation
…leanup-null.t) Agent-Logs-Url: https://github.com/Securepoint/nginx-ntlm-modulev2/sessions/be466b04-5a70-4721-a318-386dd299eb74 Co-authored-by: matthias-lay <163420385+matthias-lay@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add CI workflow to build nginx with fault-injection flag
Add fault-injection CI workflow and OOM-guard test for NGX_NTLM_TEST_CLEANUP_NULL
May 8, 2026
Copilot stopped work on behalf of
matthias-lay due to an error
May 8, 2026 09:09
…M cache assertion Agent-Logs-Url: https://github.com/Securepoint/nginx-ntlm-modulev2/sessions/60b8cb2e-4d95-44e4-9503-c0459c86962e Co-authored-by: matthias-lay <163420385+matthias-lay@users.noreply.github.com>
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TEST 6 in
t/001-sanity.t— which validates that a failedngx_pool_cleanup_add()prevents caching a stale upstream connection (ABA/session-hijack guard) — has always been unconditionally skipped because it requires nginx to be built with-DNGX_NTLM_TEST_CLEANUP_NULL. This flag was never set in CI, so the OOM guard was never exercised.New files
.github/workflows/test-cleanup-null.yml— mirrorstest-nginx-1.30.ymlbut builds nginx with the fault-injection flag and exportsNGX_NTLM_TEST_CLEANUP_NULL=1before runningprove:t/004-cleanup-null.t— self-contained test file containing TEST 6 (without--- SKIP), guarded by the env var so the normal workflow skips it gracefully:The result: normal workflow continues unchanged; the new fault-injection workflow actually exercises the
ngx_pool_cleanup_add → NULLerror path and asserts no upstream session is cached.Original prompt
Goal
Add a dedicated CI workflow that builds nginx with the fault-injection flag
-DNGX_NTLM_TEST_CLEANUP_NULLand runs the OOM-guard test (TEST 6) that is currently always skipped.Background
ngx_http_upstream_ntlm_module.ccontains a fault-injection guard:This makes
ngx_pool_cleanup_add()always returnNULLinside the module, exercising the OOM guard inngx_http_upstream_free_ntlm_peerthat prevents caching the upstream connection with a stale client-connection pointer (ABA / session-hijack).t/001-sanity.tTEST 6 covers this path but has--- SKIPbecause it requires that special build. It is therefore never executed in CI.Changes required
1. New file:
.github/workflows/test-cleanup-null.ymlCreate a new GitHub Actions workflow (modelled on the existing
.github/workflows/test-nginx-1.30.yml) with the following differences:test cleanup-null (fault injection)1.30.0(same as existing workflow)--with-cc-opt="-DNGX_NTLM_TEST_CLEANUP_NULL"to./auto/configuree.g.:
prove -r "$GITHUB_WORKSPACE/t"as usual; it will pick up the newt/004-cleanup-null.tTriggers:
pushtomainandpull_request(same as the existing workflow).2. New file:
t/004-cleanup-null.tCreate a new Perl test file that is a standalone version of TEST 6 from
t/001-sanity.t, without--- SKIP.Copy the prologue (fork + backend start + cleanup handler +
run_tests()) fromt/001-sanity.tand include only TEST 6:The test must not have
--- SKIP.Use
String::Randomand generateour $random_tokenthe same wayt/001-sanity.tdoes. Fork and startnode t/backend/index.jsand registeradd_cleanup_handlerto kill it, exactly as int/001-sanity.t.This way:
t/004-cleanup-null.tis skipped gracefully.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: what is the maximum value of c->requests
Assistant: The maximum value of
c->requestsis controlled by thentlm_requestsdirective, which setsmax_requests. The connection is considered invalid (and not reused) once:So the effective maximum allowed value of
c->requestsbefore a connection is retired is:ntlm_requests)That is,
c->requestscan reach up tomax_requests - 1(i.e., 999 by default) while still being reused. Once `c->requests >= max_...This pull request was created from Copilot chat.