unit icon indicating copy to clipboard operation
unit copied to clipboard

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

Open SailorMax opened this issue 1 year ago • 1 comments

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

SailorMax avatar Sep 17 '23 08:09 SailorMax