nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.29k stars 325 forks source link

no error hang 'Applying configuration' in case of aplication error #953

Open SailorMax opened 10 months ago

SailorMax commented 10 months ago

Unfriendly behavior in some cases.

steps:

  1. create sample express-application (nodejs) from unit's examples inside docker container
  2. setup arguments as ["nodemon", "--loader", "unit-http/loader.mjs", "--require", "unit-http/loader", "src/server.js"]
  3. docker up

expected: Some kind of error message, like "Can't start application because 'Failed to create Unit object'"

actual: init process hang on step 'Applying configuration /docker-entrypoint.d/config.json' Unit's logs has the error:

[alert] 24#37 [unit] mmap(11) failed: No such device (19)
/usr/local/lib/node_modules/unit-http/http_server.js:406
    this.unit.createServer();
              ^

Error: Failed to create Unit object
    at new Server (/usr/local/lib/node_modules/unit-http/http_server.js:406:15)
    at Object.createServer (/usr/local/lib/node_modules/unit-http/http.js:15:12)
    at Function.listen (/app/node_modules/express/lib/application.js:634:21)
    at Object.<anonymous> (/app/src/server.js:23:5)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at cjsLoader (node:internal/modules/esm/translators:283:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:233:7)

Node.js v20.6.1
Aborted

P.S. Looks like unit doesn't support nodemon. With regular node it works fine. But current problem in silent errors!

Using: unit:1.31.0-node20

tippexs commented 10 months ago

Hi @SailorMax thanks for sharing this with us! We are having two more NodeJS releated issues. I will add this one and will come back to you asap!