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

Unhandled Error in IPCTransport.autoExitHook when running under Deno 2 #305

Open
mikuso opened this issue Nov 27, 2024 · 0 comments
Open

Comments

@mikuso
Copy link

mikuso commented Nov 27, 2024

The autoExitHook method of the IPCTransport class calls an undocumented method of the node.js process class, namely _getActiveHandles.

This method does not exist in the process class of Deno 2, and so causes a crash when running under that environment.

I note that this isn't the only place in the @pm2/io code where this undocumented method is used; However, in the other instance, there is a safety check to ensure that this undocumented method exists before calling it.

See the init method of EventLoopHandlesRequestsMetric, where the following safety check is made before calling the undocumented method:

if (typeof (process as any)._getActiveHandles === 'function' && ...

As a quick-fix (without admittedly understanding the significance of autoExitHook), I would suggest adding a similar safety check to the autoExitHook method so as to not cause crashes in Deno 2. In the worst case, this change would result in a less severe bug when running under Deno 2.

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

No branches or pull requests

1 participant