Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy-load Node.js Cluster module #293

Closed
laurentgoudet opened this issue Oct 9, 2019 · 0 comments · Fixed by #294
Closed

Lazy-load Node.js Cluster module #293

laurentgoudet opened this issue Oct 9, 2019 · 0 comments · Fixed by #294

Comments

@laurentgoudet
Copy link
Contributor

Passenger provides its own clustering, and hence is not compatible with Node.js cluster module. In order to improve the developer experience, it provides a non-functional shim while warning developers about the underlying issue:

Trace: You required the Node Cluster module, which is incompatible with Passenger, a non-functional shim was returned and your app may still work. However, please remove the related code as soon as possible.
    at Module.require (/usr/share/passenger/helper-scripts/node-loader.js:63:12)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/home/app/webapp/node_modules/prom-client/lib/cluster.js:11:17)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at Module.require (/usr/share/passenger/helper-scripts/node-loader.js:80:25)

It would be nice if prom-client would lazy-load the Node.js cluster module until its aggregation features are used, i.e. until an AggregatorRegistry instance is created, in order to provide a smooth experience when integrating with Passenger.

For reference a similar issue was reported & fixed on log4js-node 2 years ago, although I don't think a disableClustering: true flag is needed here as one can simply not use the AggregatorRegistry in the first place when not using Node.js clustering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant