Unitech / Unitech/pm2

.sock Error of windows server

Open
#5,212 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

When use the windows server system, we wanna start several apps for different user
But the pm2 console error about \\.\pipe\rpc.sock and \\.\pipe\pub.sock

you just need change path.js file with

diff --git a/node_modules/pm2/paths.js b/node_modules/pm2/paths.js
index 54c08df..79ba0c2 100644
--- a/node_modules/pm2/paths.js
+++ b/node_modules/pm2/paths.js
@@ -81,10 +81,12 @@ module.exports = function(PM2_HOME) {

if (process.platform === 'win32' ||
process.platform === 'win64') {
+ console.log("USING PM2 PATCH")
+ var USERNAME = require("os").userInfo().username;
//@todo instead of static unique rpc/pub file custom with PM2_HOME or UID
- pm2_file_stucture.DAEMON_RPC_PORT = '\\\\.\\pipe\\rpc.sock';
- pm2_file_stucture.DAEMON_PUB_PORT = '\\\\.\\pipe\\pub.sock';
- pm2_file_stucture.INTERACTOR_RPC_PORT = '\\\\.\\pipe\\interactor.sock';
+ pm2_file_stucture.DAEMON_RPC_PORT = \\.\pipe\${USERNAME}\rpc.sock;
+ pm2_file_stucture.DAEMON_PUB_PORT = \\.\pipe\${USERNAME}\pub.sock;
+ pm2_file_stucture.INTERACTOR_RPC_PORT = \\.\pipe\${USERNAME}\interactor.sock;
}

There is a todo in your code,
//@todo instead of static unique rpc/pub file custom with PM2_HOME or UID,
maybe you have found some better solution, hope for upgrade

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in paths.js, focusing on the Windows branch and its TODO about making RPC and pub paths unique. Reproduce starting several PM2 apps for different users, then verify that each user's sockets are distinct and the console error is resolved without changing the requested scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.