Skip to content

Display modules (/.dm, /.dsrv, /.dmtt) each demand 262328 contiguous bytes per request: no __stklen #196

Description

@mgrossmann

Found while closing mvslovers/mvsmf#287. httpd.c:22 sets
unsigned __stklen = 64*1024; — but that only applies to the HTTPD main
program
. The display modules are separate load modules with their own
@@crt0, and none of them sets it:

module sources __stklen contiguous GETMAIN per request
HTTPD httpstrt.c httpd.c httpprm.c 64 K 65584
HTTPDM (/.dm) cgistart.c httpdm.c 262328
HTTPDSRV (/.dsrv) cgistart.c httpdsrv.c 262328
HTTPDMTT (/.dmtt) cgistart.c httpdmtt.c 262328
ABEND0C1 cgistart.c abend0c1.c 262328

httpd re-LINKs a CGI module on every request, so each /.dm or /.dsrv hit
demands a quarter megabyte of contiguous subpool 0 — for a module whose own
work is trivial. That is the demand that mvslovers/mvsmf#287 measured the
address space running out of: not storage, contiguity. Free holes of roughly
one stack each get fenced off, and a request that cannot find 262328
contiguous bytes fails U0801 / @@CRT1 - No storage for C stack before any
recovery exists.

These modules are also anvil-capable in the mechanism described in #195:
any request holding a 262 K stack for the duration is what other allocations
get planted beside.

Fix

One line per module, as httpd.c already does:

unsigned __stklen = 64 * 1024;

in httpdm.c, httpdsrv.c, httpdmtt.c and abend0c1.c.

Do not put it in cgistart.c. That looks like the tidy place — one line
covering every CGI module — but cgistart.c is autocalled out of
libhttpd.a by downstream CGI modules too, and at least one of them
(mvsMF, mvslovers/mvsmf#290) now defines __stklen itself. A definition in
the shared launcher would collide with theirs. It belongs in each module's
own translation unit.

Sizing

64 K is what httpd's own main task runs on, and mvsMF's handlers passed 544
curl tests on it. The display modules do far less than either. If any of them
needs more, /zosmf/test?fn=storage (mvsmf#289) reports the live figure out
of PPASTKLN, so the change is verifiable rather than assumed.

Refs mvslovers/mvsmf#287, mvslovers/mvsmf#290, #195.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions